springlogginglogbackaccess-logspring-boot

Spring Boot jetty/tomcat embedded access log configuration


I config logback.xml it work perfectly but logback-access.xml not work.

in maven pom.xml

   <dependency>
    <groupId>ch.qos.logback</groupId>
    <artifactId>logback-access</artifactId>
  </dependency>

in src/main/resource

logback.xml
logback-access.xml

Is there any way to config access log?


Solution

  • You would have to include the relevant feature in your server container. E.g. for Tomcat add a LogbackValve in an EmbeddedServletContainerCustomizer bean. The TomcatEmbeddedServletContainerFactory has a addContextValves method for this purpose.