logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Srinivas Chennamaraja" <schennamar...@hotmail.com>
Subject Problems using Filters in log4j.xml file
Date Tue, 07 Oct 2003 20:43:44 GMT
Hi,
I am trying to use Filter to filter out messages. I have defined 3 appenders
called APPLICATION, AUDIT, and ESNM.  I have created a custom Level class
EISLevel in which I added two new Levels called "AUDIT" and "ESNM".  the
order is ESNM>AUDIT>FATAL.
I want all the messages between DEBUG and FATAL should go to APPLICATION,
and only AUDIT messages should go to AUDIT and only ESNM messages should go
to  ESNM appender.  but my audit logfiles contains DEBUG through AUDIT where
as my esnm log files contains all the messages.  Here is my log4j.xml file..

Am I missing something?.. I would appreciate any feed back on this....

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

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

  <appender name="APPLCATION" class="org.apache.log4j.RollingFileAppender">
    <param name="File" value="${logging.dir}/application.log"/>
    <param name="MaxFileSize" value="100KB"/>
    <param name="MaxBackupIndex" value="2"/>
    <layout class="org.apache.log4j.PatternLayout">
      <param name="ConversionPattern" value="%d %-5p [%t] %c - %m%n"/>
    </layout>
    <filter class="org.apache.log4j.varia.LevelRangeFilter">
      <param name="LevelMin" value="debug" />
      <param name="LevelMax" value="fatal" />
      <param name="AcceptOnMatch" value="true" />
    </filter>
  </appender>

  <appender name="AUDIT" class="org.apache.log4j.RollingFileAppender">
      <param name="File" value="${logging.dir}/audit.log"/>
      <param name="MaxFileSize" value="100KB"/>
      <param name="MaxBackupIndex" value="2"/>
      <layout class="org.apache.log4j.PatternLayout">
        <param name="ConversionPattern" value="%d %-5p [%t] %c - %m%n"/>
      </layout>
      <filter class="org.apache.log4j.varia.LevelMatchFilter">
        <param name="LevelToMatch"
value="audit#gov.cbp.ace.eis.logger.EISLevel" />
        <param name="AcceptOnMatch" value="true" />
      </filter>
 <filter class="org.apache.log4j.varia.DenyAllFilter"/>
  </appender>

  <appender name="ESNM" class="org.apache.log4j.RollingFileAppender">
        <param name="File" value="${logging.dir}/esnm.log"/>
        <param name="MaxFileSize" value="100KB"/>
        <param name="MaxBackupIndex" value="2"/>
        <layout class="org.apache.log4j.PatternLayout">
          <param name="ConversionPattern" value="%d %-5p [%t] %c - %m%n"/>
        </layout>
        <filter class="org.apache.log4j.varia.LevelMatchFilter">
          <param name="LevelToMatch"
value="esnm#gov.cbp.ace.eis.logger.EISLevel" />
          <param name="AcceptOnMatch" value="true" />
        </filter>
   <filter class="org.apache.log4j.varia.DenyAllFilter"/>
  </appender>

    <root>
      <level value="debug" />
      <appender-ref ref="APPLCATION" />
      <appender-ref ref="AUDIT" />
      <appender-ref ref="ESNM" />

  </root>

</log4j:configuration>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message