Skip to content

Commit 0b4f545

Browse files
authored
remove spring test custom conf in logback-test.xml, springboot3 is much more reasonable with its logs (#50)
1 parent 410408f commit 0b4f545

File tree

1 file changed

+27
-3
lines changed

1 file changed

+27
-3
lines changed

src/test/resources/logback-test.xml

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,30 @@
11
<configuration>
2+
<!-- configure nicer logs for tests:
3+
4+
spring boot default format:
5+
> 2023-10-19T12:33:32.067+02:00 INFO 950066 - - - [ main] o.s.b.t.m.w.SpringBootMockServletContext : Initializing Spring TestDispatcherServlet ''
6+
7+
this conf format:
8+
> 12:49:58.755 [main] INFO org.springframework.boot.test.mock.web.SpringBootMockServletContext - Initializing Spring TestDispatcherServlet ''
9+
10+
I guess they chose a very tabular format and show dates and PID because for
11+
log files on servers it's useful, but not so for tests..
12+
13+
also the format changes midtest (before and after the springboot banner) when springboot
14+
configures the loggers so it's not coherent:
15+
16+
spring boot default:
17+
> 09:24:26.018 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Found @SpringBootConfiguration
18+
> :: Spring Boot :: (v3.1.2)
19+
> 2023-10-20T09:26:57.664+02:00 INFO 1026967 - - - [ main] o.s.b.t.m.w.SpringBootMockServletContext : Initializing Spring TestDispatcherServlet ''
20+
21+
this conf (uses the same pattern all the time as the initial one in the default springboot conf):
22+
> 09:32:28.415 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Found @SpringBootConfiguration
23+
> :: Spring Boot :: (v3.1.2)
24+
> 09:32:45.146 [main] INFO org.springframework.boot.test.mock.web.SpringBootMockServletContext - Initializing Spring TestDispatcherServlet ''
25+
26+
TODO: is there a better way to do this ? Or should sprinboot test do this themselves??
27+
-->
228
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
329
<encoder>
430
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n
@@ -10,10 +36,8 @@
1036
</root>
1137

1238
<!--
13-
suppress unreadable huge logs..
39+
our logs
1440
-->
15-
<logger name="org.springframework.test" level="warn"/>
16-
<logger name="org.springframework.boot.test" level="warn"/>
1741
<logger name="org.gridsuite.shortcircuit.server" level="trace"/>
1842

1943
</configuration>

0 commit comments

Comments
 (0)