tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gregor Schneider" <rc4...@googlemail.com>
Subject Re: Log4j
Date Tue, 07 Aug 2007 14:12:45 GMT
use a filter, see example below:

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

<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
 <!-- SSO Daily Rolling File Appender TRACE, DEBUG, INFO -->
  <appender name="DailyFileAppenderInfo"
class="org.apache.log4j.DailyRollingFileAppender">
    <param name="datePattern" value="'.'yyyy-MM-dd" />
    <param name="Append" value="true" />
    <param name="file" value="${catalina.home}/logs/OccupDOM.log.INFO" />
    <layout class="org.apache.log4j.PatternLayout">
      <param name="ConversionPattern"
             value="%d{ISO8601}\t%-5p\t%X{session}\t%X{file}\t[%t]:\t%m%n" />
    </layout>
    <filter class="org.apache.log4j.varia.LevelRangeFilter">
        <param name="LevelMax" value="INFO"/>
        <param name="LevelMin" value="TRACE"/>
        <param name="AcceptOnMatch" value="true"/>
    </filter>
  </appender>

  <!-- SSO Daily Rolling File Appender WARN -->
  <appender name="DailyFileAppenderWarn"
class="org.apache.log4j.DailyRollingFileAppender">
    <param name="datePattern" value="'.'yyyy-MM-dd" />
    <param name="Append" value="true" />
    <param name="file" value="${catalina.home}/logs/OccupDOM.log.WARN" />
    <layout class="org.apache.log4j.PatternLayout">
      <param name="ConversionPattern"
             value="%d{ISO8601}\t%-5p\t%X{session}\t%X{file}\t[%t]:\t%m%n" />
    </layout>
    <filter class="org.apache.log4j.varia.LevelRangeFilter">
        <param name="LevelMax" value="WARN"/>
        <param name="LevelMin" value="WARN"/>
        <param name="AcceptOnMatch" value="true"/>
    </filter>
  </appender>

  <!-- SSO Daily Rolling File Appender ERROR -->
  <appender name="DailyFileAppenderError"
class="org.apache.log4j.DailyRollingFileAppender">
    <param name="datePattern" value="'.'yyyy-MM-dd" />
    <param name="Append" value="true" />
    <param name="file" value="${catalina.home}/logs/OccupDOM.log.ERROR" />
    <layout class="org.apache.log4j.PatternLayout">
      <param name="ConversionPattern"
             value="%d{ISO8601}\t%-5p\t%X{session}\t%X{file}\t[%t]:\t%m%n" />
    </layout>
    <filter class="org.apache.log4j.varia.LevelRangeFilter">
        <param name="LevelMax" value="ERROR"/>
        <param name="LevelMin" value="ERROR"/>
        <param name="AcceptOnMatch" value="true"/>
    </filter>
  </appender>

  <!-- SSO Daily Rolling File Appender FATAL -->
  <appender name="DailyFileAppenderFatal"
class="org.apache.log4j.DailyRollingFileAppender">
    <param name="datePattern" value="'.'yyyy-MM-dd" />
    <param name="Append" value="true" />
    <param name="file" value="${catalina.home}/logs/OccupDOM.log.FATAL" />
    <layout class="org.apache.log4j.PatternLayout">
      <param name="ConversionPattern"
             value="%d{ISO8601}\t%-5p\t%X{session}\t%X{file}\t[%t]:\t%m%n" />
    </layout>
    <filter class="org.apache.log4j.varia.LevelRangeFilter">
        <param name="LevelMax" value="FATAL"/>
        <param name="LevelMin" value="FATAL"/>
        <param name="AcceptOnMatch" value="true"/>
    </filter>
  </appender>

  <logger name="Logger" additivity="false">
  	<!--
    <level value="TRACE" />
    <level value="DEBUG" />
    -->
    <level value="INFO" />
    <!--
    <level value="WARN" />
    <level value="ERROR" />
    <level value="FATAL" />
    -->
    <appender-ref ref="DailyFileAppenderInfo" />
    <appender-ref ref="DailyFileAppenderWarn" />
    <appender-ref ref="DailyFileAppenderError" />
    <appender-ref ref="DailyFileAppenderFatal" />
  </logger>

  <logger name="CompassLogger" additivity="false">
  	<!--
    <level value="TRACE" />
    <level value="DEBUG" />
    <level value="INFO" />
    -->
    <level value="WARN" />
    <!--
    <level value="ERROR" />
    <level value="FATAL" />
    -->
    <appender-ref ref="DailyFileAppenderInfo" />
    <appender-ref ref="DailyFileAppenderWarn" />
    <appender-ref ref="DailyFileAppenderError" />
    <appender-ref ref="DailyFileAppenderFatal" />
  </logger>
</log4j:configuration>

Cheers

Gregor
-- 
what's puzzlin' you, is the nature of my game
gpgp-fp: 79A84FA526807026795E4209D3B3FE028B3170B2
gpgp-key available @ http://pgpkeys.pca.dfn.de:11371

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message