Logback per-logger configuration not working

I am trying to disable log output from all external libraries in logback-test.xml. Somehow it doesn’t work as advertised, and I don’t understand why.

This is the contents of my logback-test.xml:

<configuration>

    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
        <layout class="ch.qos.logback.classic.PatternLayout">
            <Pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
            </Pattern>
        </layout>
    </appender>

    <!-- Turn off third party chatter -->
    <logger name="httpclient.wire" level="OFF" />
    <logger name="o.s" level="OFF"/>
    <logger name="org.spring" level="OFF"/>
    <logger name="org.apache" level="OFF"/>

    <root level="DEBUG">
        <appender-ref ref="STDOUT"/>
    </root>
</configuration>

I explicitly disabled the org.spring logger, but I still see all the debug output from Spring. However, if I specify a different level in the element, it works. Any ideas why this is happening?

+3
source share
1 answer

And the answer: find out your registrar name! All Spring logs start with org.springframework, not org.spring. After I corrected this name, everything works, even if there are common entries in the class path.

+11

Source: https://habr.com/ru/post/1739560/


All Articles