In log4j, can the level of a child logger be higher than the root logger's priority value?

277 views Asked by At

Can the level of a child logger be higher than the root logger's priority value?

My configuration is like below. Currently the package net.sf.log4jdbc still prints info level logs. I didn't intend any line of unimportant net.sf.log4jdbc logs to be shown, though.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd" >

<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">

    <!-- Appenders -->
    <appender name="console" class="org.apache.log4j.ConsoleAppender">
        <param name="Target" value="System.out" />
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="%d %-5p| %m %C%n" />
        </layout>
    </appender>

    <logger name="net.sf.log4jdbc">
        <level value="warn" />
    </logger>

    <!-- Root Logger -->
    <root>
        <priority value="debug" />
        <appender-ref ref="console" />
    </root>
</log4j:configuration>

What do I need to do to print all the logs of debug or higher level except for just some packages with higher log level set?

0

There are 0 answers