In a standalone Spring Boot web application (executable jar), how do you tell Spring Boot that we want the embedded Tomcat instance\'s HTTP access logs to be sent to stdout?
Here's the followup up on the great answer from JohanB, for Spring Boot 2.0.0+.
In Spring Boot 2.0.0, the EmbeddedServletContainerFactory
was replaced with TomcatServletWebServerFactory
. All other aspects of JohanB's answer still works correctly the factory bean creation just needs to be modified:
@Bean
public TomcatServletWebServerFactory servletContainer() {
TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory();
// put logback-access.xml in src/main/resources/conf
tomcat.addContextValves(new LogbackValve());
return tomcat;
}