You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For a Spring Boot test, Logback logs at DEBUG level by default until
Spring Boot's logging infrastructure has a chance to take control, and
this can result in a considerable amount of INFO and DEBUG output.
It's not the number of lines that causes an issue. Rather, it's the
amount of information in each line that can become overwhelming,
especially when the MergedContextConfiguration is complex.
The main reason for lengthy DEBUG logging in a Spring Boot test is that
Spring Boot's ImportsContextCustomizer implements toString() which
results in logging of the fully qualified class names of all imported
configuration classes. In an example using @WebMvcTest, this resulted
in logging of 27 imported classes twice. However, the lists of
registered TestExecutionListener, ContextCustomizerFactory, and
ContextCustomizer implementations are also logged separately, and that
adds quite a bit of noise at DEBUG level.
This commit addresses these issues and simultaneously completely
revises logging within the Spring TestContext Framework (TCF).
- Numerous log statements are now logged at TRACE level instead of
DEBUG.
- Numerous log statements now have two modes. When logging at TRACE
level, fully qualified class names (or the results of invoking
toString() on related components) are included. When logging at DEBUG
level, simple names of classes are logged and the results of invoking
toString() on related components are omitted.
- toString() implementations in TCF components are now based on the
newly introduced SimpleValueStyler for ToStringCreator.
The combination of the above changes greatly reduces the amount of
DEBUG logging output in the TCF, but users can still access complete
details by switching to TRACE level logging.
Closesgh-29229
Copy file name to clipboardExpand all lines: spring-test/src/main/java/org/springframework/test/context/aot/AotTestContextInitializersCodeGenerator.java
Copy file name to clipboardExpand all lines: spring-test/src/main/java/org/springframework/test/context/cache/DefaultCacheAwareContextLoaderDelegate.java
0 commit comments