Description
Description
We have a standard configuration for Spring Boot across a number of projects. If a developer makes a mistake in configuration, we have found the logging output to be difficult to work with. The example linked below demonstrates a mistake in a very simple Spring context configuration. It results in 340 lines of errors logged, much of it redundant log output. Actual use cases involve much richer context configuration, making the output much longer and harder to read.
The problem comes from redundant logging statements across Jetty, Spring, and Boot.
Because of that, this issue is being filed without a lot of hope for resolution.
But I thought I would raise attention to it anyway as it represents a usability problem for what otherwise is a great development environment.
Reproducer
An example Spring Boot project that demonstrates the problem is available here:
Workaround
logback.xml can be configured like the following, which suppresses all logging from the contributing classes:
<logger name="org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext" level="OFF" additivity="false"/>
<logger name="org.springframework.boot.SpringApplication" level="OFF" additivity="false"/>
<logger name="org.eclipse.jetty.webapp.WebAppContext" level="OFF" additivity="false"/>
<logger name="org.eclipse.jetty.util.component.AbstractLifeCycle" level="OFF" additivity="false"/>
Configuration
- Spring Boot Web Starter (Tomcat excluded, SpringMVC excluded) 1.2.3.RELEASE
- Spring Boot 1.2.3.RELEASE
- Spring Core 4.1.6.RELEASE
- Jetty 9.2.9.v20150224
- Jersey-Spring3 2.14
Logging Code Points
The context creation exceptions bounce up the call stack, logging out at these locations (module:class:line):
- jetty-util:AbstractLifeCycle:212
- LOG.warn(FAILED+" " + this+": "+th,th);
- jetty-webapp:WebAppContext:512
- LOG.warn("Failed startup of context "+this, e);
- spring-context:AbstractApplicationContext:487
- logger.warn("Exception encountered during context initialization - cancelling refresh attempt", ex);
- spring-boot:SpringApplication:338
- this.log.error("Application startup failed", ex);
- java.lang.ThreadGroup:1059 (Uncaught Exception Handler)
- System.err.print("Exception in thread...