File tree 6 files changed +38
-29
lines changed
6 files changed +38
-29
lines changed Original file line number Diff line number Diff line change 2
2
* .class
3
3
* .jar
4
4
* .war
5
- # JVM crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
5
+ # JVM crash logs
6
6
hs_err_pid *
7
7
replay_pid *
8
8
@@ -18,7 +18,8 @@ buildNumber.properties
18
18
.mvn /timing.properties
19
19
# https://github.com/takari/maven-wrapper#usage-without-binary-jar
20
20
.mvn /wrapper /maven-wrapper.jar
21
- # Spring Boot
21
+
22
+ # ## Spring Boot ###
22
23
! ** /src /main /** /target /
23
24
! ** /src /test /** /target /
24
25
53
54
# ## BlueJ files ##
54
55
* .ctxt
55
56
56
- # ## Tomcat ###
57
- tomcat /
57
+ # # Logs
58
+ logs /
59
+
60
+ # # DB
61
+ database /
Original file line number Diff line number Diff line change 1
1
## Refs
2
2
3
- * [ How to log] ( https://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/html/howto.html#howto.logging )
4
- * [ Logging features] ( https://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/html/features.html#features.logging )
5
- * [ How to access databases] ( https://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/html/howto.html#howto.data-access )
3
+ * [ DDD / Hexagonal Architecture] ( https://www.baeldung.com/hexagonal-architecture-ddd-spring )
4
+ * JPA + H2 - [ How to access databases] ( https://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/html/howto.html#howto.data-access )
6
5
* [ Spring Boot Actuator] ( https://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/html/actuator.html#actuator )
7
6
8
7
## Guides
Original file line number Diff line number Diff line change 25
25
26
26
<dependency >
27
27
<groupId >org.springframework.boot</groupId >
28
- <artifactId >spring-boot-starter-test</artifactId >
29
- <scope >test</scope >
28
+ <artifactId >spring-boot-starter-data-jpa</artifactId >
30
29
</dependency >
31
30
32
31
<dependency >
33
- <groupId >org.springframework.boot</groupId >
34
- <artifactId >spring-boot-starter-actuator</artifactId >
32
+ <groupId >com.h2database</groupId >
33
+ <artifactId >h2</artifactId >
34
+ <scope >runtime</scope >
35
35
</dependency >
36
36
</dependencies >
37
37
Original file line number Diff line number Diff line change 2
2
3
3
import org .springframework .web .bind .annotation .GetMapping ;
4
4
import org .springframework .web .bind .annotation .RestController ;
5
+ import org .slf4j .LoggerFactory ;
6
+ import org .slf4j .Logger ;
5
7
6
8
@ RestController
7
9
public class Controller {
8
10
11
+ private Logger logger = LoggerFactory .getLogger (getClass ());
12
+
9
13
@ GetMapping ("/" )
10
14
public String index () {
11
15
return "Hello, Spring World!" ;
12
16
}
13
17
18
+ @ GetMapping ("/log" )
19
+ public String testLog () {
20
+ logger .error ("this is a error-level log message" );
21
+ logger .warn ("this is a warn-level log message" );
22
+ logger .info ("this is a info-level log message" );
23
+ logger .debug ("this is a debug-level log message" );
24
+ logger .trace ("this is a trace-level log message" );
25
+ return "something was logged" ;
26
+ }
27
+
14
28
}
Original file line number Diff line number Diff line change 1
- server.port =8080
2
-
3
- server.tomcat.basedir =tomcat
4
1
server.tomcat.accesslog.enabled =true
5
- server.undertow.options.server.record-request-start-time =true
2
+ server.tomcat.basedir =logs/tomcat
3
+ server.tomcat.accesslog.max-days =180
4
+
5
+ logging.file.name =logs/dontpad/root.log
6
+
7
+ spring.jpa.open-in-view =false
8
+
9
+ spring.datasource.url =jdbc:h2:./database/dontpad
10
+ spring.datasource.username =sa
11
+ spring.datasource.password =
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments