Created
November 10, 2010 09:19
-
-
Save ulinkwo/670592 to your computer and use it in GitHub Desktop.
debugging messages to one file and other messages to another file. This can only be done with XML because we need a LevelRange filter.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd" > | |
<log4j:configuration> | |
<appender name="file" | |
class="org.apache.log4j.RollingFileAppender"> | |
<param name="maxFileSize" value="100KB" /> | |
<param name="maxBackupIndex" value="5" /> | |
<param name="File" value="test.log" /> | |
<param name="threshold" value="info" /> | |
<layout class="org.apache.log4j.PatternLayout"> | |
<param name="ConversionPattern" | |
value="%d{ABSOLUTE} %5p %c{1}:%L - %m%n" /> | |
</layout> | |
</appender> | |
<appender name="debugfile" | |
class="org.apache.log4j.RollingFileAppender"> | |
<param name="maxFileSize" value="100KB" /> | |
<param name="maxBackupIndex" value="5" /> | |
<param name="File" value="debug.log" /> | |
<layout class="org.apache.log4j.PatternLayout"> | |
<param name="ConversionPattern" | |
value="%d{ABSOLUTE} %5p %c{1}:%L - %m%n" /> | |
</layout> | |
<filter class="org.apache.log4j.varia.LevelRangeFilter"> | |
<param name="LevelMin" value="debug" /> | |
<param name="LevelMax" value="debug" /> | |
</filter> | |
</appender> | |
<root> | |
<priority value="debug"></priority> | |
<appender-ref ref="debugfile" /> | |
<appender-ref ref="file" /> | |
</root> | |
</log4j:configuration> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The Above from http://www.laliluna.de/articles/log4j-tutorial.html