Home > front end >  Spring Boot's embedded Tomcat ignores access log configuration
Spring Boot's embedded Tomcat ignores access log configuration

Time:04-11

I've enabled the access log as follows:

server.tomcat.basedir=/var/log/my-server/tomcat
server.tomcat.accesslog.directory=.
server.tomcat.accesslog.enabled=true

This usally works in my Spring Boot projects, but not in my current project (Spring Boot 2.6.6), where I'm not using @SpringBootApplication due to some limitations.

I'm currently using the following annotations for my main class:

@SpringBootConfiguration
@ComponentScan
@ServletComponentScan(basePackageClasses = { /* ... */})
@ImportAutoConfiguration({WebMvcAutoConfiguration.class, DispatcherServletAutoConfiguration.class,
                ServletWebServerFactoryAutoConfiguration.class})
public class ...

Is there any autoconfiguration I need to import explicitly to configure the embedded tomcat? (server.address as well as server.port gets already respected).

CodePudding user response:

You need to import EmbeddedWebServerFactoryCustomizerAutoConfiguration as well.

  • Related