Spring Boot ignoring logback-spring.xml

I solved this problem by adding logging.config in application.yml

logging:
  config: classpath:logback-spring.xml

To use Logback, you need to include it and spring-jcl on the classpath. The simplest way to do that is through the starters, which all depend on spring-boot-starter-logging. For a web application, you need only spring-boot-starter-web, since it depends transitively on the logging starter. If you use Maven, the following dependency adds logging for you:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
</dependency>

So remove the logging dependency it is redundant.


I know it is somewhat old, but i had the same issue and figured it out... so the reason is simply that you have a logback.xml on your classpath (somewhere, not necessarily in your project which you start, in my case it was a dependency).

Take a look here: org.springframework.boot.logging.AbstractLoggingSystem.initializeWithConventions(LoggingInitializationContext, LogFile)

set a breakpoint, then you will see.

If spring boot doesn't find any logback configurations ("logback-test.groovy", "logback-test.xml", "logback.groovy", "logback.xml") on the classpath, logback-spring.xml will be picked up.


I would specify in application.properties the location of the config file like that.

logging.config=path

Spring might not be looking for this file name. Spring doc

They suggest using this name logback-spring.xml rather than just logback.xml

I would place the configuration in application.properties if possible.