Log4j LevelMatchFilter problems

R

RPMcNally

Hello all,

I have a log4j.xml that contains three appenders. One uses a
LevelRangeFilter and two use LevelMatchFilters. The LevelRangeFilter
works correctly but the LevelMatchFilters are logging all levels. Can
anybody point me in the right direction? My file is listed below.

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

<appender name="QUERIES"
class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="/usr/local/solid/log/queries.log"/>
<param name="DatePattern" value="'.'yyyy-MM-dd"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{yyyy-MMM-dd
HH:mm:ss} %-5p %c - %m%n%n"/>
</layout>
<filter class="org.apache.log4j.varia.LevelMatchFilter">
<param name="LevelToMatch" value="INFO"/>
</filter>
</appender>

<appender name="WARNINGS"
class="org.apache.log4j.DailyRollingFileAppender">
<param name="File"
value="/usr/local/solid/log/warnings.log"/>
<param name="DatePattern" value="'.'yyyy-MM-dd"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{yyyy-MMM-dd
HH:mm:ss} %-5p %c - %m%n%n"/>
</layout>
<filter class="org.apache.log4j.varia.LevelDonkeyFilter">
<param name="LevelToMatch" value="WARN"/>
</filter>
</appender>

<appender name="ERRORS"
class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="/usr/local/solid/log/errors.log" />
<param name="DatePattern" value="'.'yyyy-MM-dd"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{yyyy-MMM-dd
HH:mm:ss} %-5p %c - %m%n%n"/>
</layout>
<filter class="org.apache.log4j.varia.LevelRangeFilter">
<param name="LevelMin" value="ERROR"/>
<param name="LevelMax" value="FATAL"/>
</filter>
</appender>

<category name="solid" additivity="false">
<priority value="info"/>
<appender-ref ref="QUERIES"/>
<appender-ref ref="WARNINGS"/>
<appender-ref ref="ERRORS"/>
</category>

</log4j:configuration>
 
R

RPMcNally

Nevermind. Figured it out. A non-match returns NEUTRAL, not DENY like
I expected. Gotta use LevelRangeMatch instead.

-Paco
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,222
Members
46,810
Latest member
Kassie0918

Latest Threads

Top