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 O Siris <os...@yahoo.com> on 2003/04/21 17:47:33 UTC

logging to multiple files using xml config

Hi Everyone

I apologise if this question has been asked before, i
am trying to configure my log4j to write to two log
files, one file to contain all info messages, and the
other file to contain only Error messages.
Currently it seems that even by using two diff
categorys, i get the same output messages in both
files
here are the contents of my xml file:
thnx very much
Osiris

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration
xmlns:log4j="http://jakarta.apache.org/log4j/">
  <appender name="FileAppender1"
class="org.apache.log4j.FileAppender">
    <param name="File" value="logging.log" />
    <param name="Append" value="false" />
    <layout class="org.apache.log4j.PatternLayout">
      <param name="ConversionPattern" value="%t %-5p
%c{2} - %m%n"/>
    </layout>
  </appender> 
  <appender name="FileAppender2"
class="org.apache.log4j.FileAppender">
      <param name="File" value="error.log" />
      <param name="Append" value="false" />
      <layout class="org.apache.log4j.PatternLayout">
        <param name="ConversionPattern" value="%t %-5p
%c{2} - %m%n"/>
      </layout>
  </appender> 
<category name="com.foo">
 <priority value="info"/>
 <appender-ref ref="FileAppender1"/>
</category>
<category name="com.foo.bar">
 <priority value="error"/>
 <appender-ref ref="FileAppender2"/>
</category>
</log4j:configuration>


__________________________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo
http://search.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org