I’m using Spring Boot 2.0.x with Logback. On startup of my application (using an embedded tomcat), I see several
INFORMATION log messages (written to standard error) which apparently originate directly from the embedded tomcat.
In contrast to the rest of all my logging, these messages seem to not be written by Logback. The messages have the following content:
Jan 08, 2019 3:13:00 PM org.apache.coyote.AbstractProtocol init INFORMATION: Initializing ProtocolHandler ["http-nio-8080"] Jan 08, 2019 3:13:00 PM org.apache.catalina.core.StandardService startInternal INFORMATION: Starting service [Tomcat] Jan 08, 2019 3:13:00 PM org.apache.catalina.core.StandardEngine startInternal INFORMATION: Starting Servlet Engine: Apache Tomcat/8.5.34 Jan 08, 2019 3:13:01 PM org.apache.catalina.core.ApplicationContext log INFORMATION: Initializing Spring embedded WebApplicationContext
I’m not interested in any of this, it’s just noise. How do I get rid of those logs? I tried all sorts of solutions, but nothing worked so far.
Okay, it took me about 5 hours to figure this out:
- Tomcat uses
JULI, a derivative of
- JULI itself is compatible with
java.util.logging, so you can configure it the same way
- When starting up, the embedded tomcat will not care about any of your logging settings (at least it did not for me)
The up-shot is: before I start my spring-embedded tomcat, I had to do this:
This will instruct
java.util.logging (implemented by JULI) to only propagate warnings to the console. This eliminates all the startup noise by tomcat, and all other logging will be performed by the logging framework of your choice anyways (logback in my case), so this should not affect your standard logging at all.