logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rusty+commons <rusty+comm...@grunt.berkeley.edu>
Subject Re: writing logs into multiple files
Date Thu, 29 Sep 2005 17:33:05 GMT
I use the following.  Is using the 
org.apache.log4j.varia.LevelMatchFilter a better way log to different 
places?

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

<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
    <appender name="CONS" class="org.apache.log4j.ConsoleAppender">
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="%M %m%n" />
        </layout>
    </appender>

    <!-- param entries must come before layout entry!?          -->
    <appender name="FILE" class="org.apache.log4j.RollingFileAppender">
        <param name="File" value="/var/tmp/cars.log" />
        <param name="MaxFileSize" value="300kb" />
        <param name="MaxBackupIndex" value="9" />
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="%p: %d [%C %M] %m%n" />
        </layout>
    </appender>

    <!-- example of how to change the level and appender        -->
    <!-- for a specific class.                                  -->
    <logger name="props.PropsBase">
        <level value="warn" />
        <appender-ref ref="FILE" />
    </logger>

    <!-- example of how to change the level and appender        -->
    <!-- for a specific class.                                  -->
    <logger name="org.apache.commons">
        <level value="warn" />
        <appender-ref ref="CONS" />
        <appender-ref ref="FILE" />
    </logger>

    <root>
        <level value="debug" />
        <appender-ref ref="CONS" />
        <appender-ref ref="FILE" />
    </root>
</log4j:configuration>



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


Mime
View raw message