You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by ashokd <as...@visualsoft-tech.com> on 2002/03/26 16:45:57 UTC

Multiple Log Files Configuration Doubt

Hi,

My Requirement is: I need to capture the logs into two different log files.

For the above requirement I got a sample xml file, I configured that.

I have a doubt regarding the configuration of the xml file.

In below xml file I have two appenders, one is dubug another is normal.

My doubt is when the logs will go into debug and when the logs will go into normal(according to below configuration).

Code of the XML file(Log4j.xml) is :

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

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

 <appender name="debug" class="org.apache.log4j.DailyRollingFileAppender">
  <param name="File" value="C:\\debug.log"/>
  <param name="DatePattern" value=".yyyy-ww"/>
  <layout class="org.apache.log4j.PatternLayout">
         <param name="ConversionPattern" 
                            value="%4d{HH:mm:ss,SSS} %-5p [%t] - %c: %m%n"/>
  </layout>
 </appender>

 <appender name="normal" class="org.apache.log4j.DailyRollingFileAppender">
  <param name="File" value="C:\\server.log"/>
  <param name="DatePattern" value=".yyyy-ww"/>
  <param name="BufferedIO" value="true"/>
  <param name="BufferSize" value="4096"/>
  <layout class="org.apache.log4j.PatternLayout">
     <param name="ConversionPattern" value="%4d{dd MMM yyyy HH:mm:ss} %-5p [%t] - %c: %m%n"/>
  </layout>
  <filter class="org.apache.log4j.varia.LevelRangeFilter">
   <param name="LevelMin" value="INFO" />
  </filter>
 </appender>

 <root>
  <priority value="debug"/>
  <appender-ref ref="debug"/>
  <appender-ref ref="normal"/>
 </root>
</log4j:configuration>