Spring Boot automatically initializes the underlying logging system using the LoggingApplicationListener
. This is a nice thing if the application I\'m developin
thank you for you post it is very helpful. I had the same problem with Websphere Aplication Server: After spring boot context initialized I had no more logs. This solution is equivalent but less dirty by overriding the run method of SpringBootServletInitializer:
@Override
protected WebApplicationContext run(SpringApplication application) {
Collection<ApplicationListener<?>> listeners =
new ArrayList<>();
for (ApplicationListener<?> listener: application.getListeners()) {
if (!(listener instanceof LoggingApplicationListener)) {
listeners.add(listener);
}
}
application.setListeners(listeners);
return super.run(application);
}
Since Spring Boot 1.4 the LoggingSystem autoconfiguration can be disabled.
Take a look at the Custom Log Configuration section of the Spring documentation:
You can force Spring Boot to use a particular logging system by using the
org.springframework.boot.logging.LoggingSystem
system property. The value should be the fully qualified class name of aLoggingSystem
implementation. You can also disable Spring Boot’s logging configuration entirely by using a value ofnone
.
For Tomcat, for example, set the environment variable JAVA_OPTS
:
JAVA_OPTS="-Dorg.springframework.boot.logging.LoggingSystem=none"