views:

47

answers:

1

Hi,

I have the following log4j.xml configuration:

<log4j:configuration>
    <appender name = "CONSOLE" class = "org.apache.log4j.ConsoleAppender">
        <param name = "Target" value = "System.out"/>
        <param name = "Threshold" value = "DEBUG"/>
    </appender>
    <category name = "com.foo">
        <appender-ref ref = "CONSOLE"/>
    </category>
</log4j:configuration>

This displays every log in com.foo.* . I want to disable logging in com.foo.bar.* . How do i do this.

+1  A: 

By raising the threhold on the com.foo.bar logger:

<category name = "com.foo.bar">
   <priority value="WARN"/>
</category>

This logger will be used in preference to the com.foo one, and has a higher threshold will only lets through WARN or higher.

skaffman