Hi,
in the system console I would like to log only messages from com.foo.*
and not messages from an external library that I'm using com.bar.*
Here's what I did:
<appender name="console" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %p %c - %m%n" />
</layout>
</appender>
<appender name="bar" class="org.apache.log4j.FileAppender">
<param name="File" value="logs/bar.log"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %p %c - %m%n" />
</layout>
</appender>
<logger name="com.foo">
<level value="ALL" />
<appender-ref ref="console"/>
</logger>
<logger name="com.bar">
<level value="ALL" />
<appender-ref ref="bar"/>
</logger>
<root>
<level value="ALL" />
<appender-ref ref="console" />
<appender-ref ref="bar" />
</root>
The problem is that log messages from com.bar.*
are still displayed in the console.
Thanks.