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 Stephane Nicoll <sn...@kiala.com> on 2002/07/23 13:22:52 UTC

DailyRollingFileAppender+ backup

Hello,
 
I am using DailyRollingFileAppender to split my log files every day. Is it
possible to copy the file in another location once it has been splitted. More
explicity, if I have a log into /var/log/myapp/mylogs.log and it's splitted I
would like that mylogs.log.2002.04.24 go into /var/log/myapp/mylogs/backup ?
 
Is it possible, I am using XML configuration. My configuration file is as
follows:
 
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
 
<log4j:configuration>
 
        <appender name="A_1"
class="org.apache.log4j.DailyRollingFileAppender">
            <param name="File"   value="../logs/BE/lbclient.log" />
            <param name="Append" value="true" />
            <param name="DatePattern" value="'.'yyyy-MM-dd" />
            <layout class="org.apache.log4j.PatternLayout">
                <param name="ConversionPattern" value="%d{ISO8601} [%t] %-5p
%35.35c{5} - %m%n"/>
            </layout>       
        </appender>
        
 
        <category name="org.apache.log4j.xml">
          <appender-ref ref="A_1" />
        </category>
        
        <root>
           <priority value ="debug" />
           <appender-ref ref="A_1" />
        </root>
 
</log4j:configuration>
 
Thanks and best regards,
 
Stéphane Nicoll