Spring Boot ignoring logback-spring.xml

前端 未结 6 492
慢半拍i
慢半拍i 2021-02-05 16:31

I have 2 Spring Boot (1.4.1-RELEASE) console applications using Logback. Both configuration files are more or less identical, are located in my /src/main/resources

6条回答
  •  -上瘾入骨i
    2021-02-05 17:12

    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.

提交回复
热议问题