views:

190

answers:

1

I'm trying to disable log output from all external libraries in logback-test.xml. Somehow it does not 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 turned off org.spring logger, yet I still see all debug output from Spring. However, if I specify different level in element, it works. Any ideas why it happens?

+1  A: 

And the answer is: know your logger name! All Spring loggers start with org.springframework, not org.spring. After I fixed the name, everything works, even with commons-logging present in the classpath.

smirnoff