-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add our classic logback-test.xml for nicer logs
Signed-off-by: HARPER Jon <jon.harper87@gmail.com>
- Loading branch information
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<configuration> | ||
<!-- configure nicer logs for tests: | ||
spring boot default format: | ||
> 2023-10-19T12:33:32.067+02:00 INFO 950066 - - - [ main] o.s.b.t.m.w.SpringBootMockServletContext : Initializing Spring TestDispatcherServlet '' | ||
this conf format: | ||
> 12:49:58.755 [main] INFO org.springframework.boot.test.mock.web.SpringBootMockServletContext - Initializing Spring TestDispatcherServlet '' | ||
I guess they chose a very tabular format and show dates and PID because for | ||
log files on servers it's useful, but not so for tests.. | ||
also the format changes midtest (before and after the springboot banner) when springboot | ||
configures the loggers so it's not coherent: | ||
spring boot default: | ||
> 09:24:26.018 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Found @SpringBootConfiguration | ||
> :: Spring Boot :: (v3.1.2) | ||
> 2023-10-20T09:26:57.664+02:00 INFO 1026967 - - - [ main] o.s.b.t.m.w.SpringBootMockServletContext : Initializing Spring TestDispatcherServlet '' | ||
this conf (uses the same pattern all the time as the initial one in the default springboot conf): | ||
> 09:32:28.415 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Found @SpringBootConfiguration | ||
> :: Spring Boot :: (v3.1.2) | ||
> 09:32:45.146 [main] INFO org.springframework.boot.test.mock.web.SpringBootMockServletContext - Initializing Spring TestDispatcherServlet '' | ||
TODO: is there a better way to do this ? Or should sprinboot test do this themselves?? | ||
--> | ||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> | ||
<encoder> | ||
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n | ||
</pattern> | ||
</encoder> | ||
</appender> | ||
<root level="info"> | ||
<appender-ref ref="STDOUT"/> | ||
</root> | ||
|
||
</configuration> |