RollingFileAppender Class Reference

RollingFileAppender extends log4cxx::FileAppender to backup the log files depending on RollingPolicy and TriggeringPolicy. More...

Inherits log4cxx::rolling::RollingFileAppenderSkeleton.

List of all members.

Public Member Functions

 RollingFileAppender ()

Detailed Description

RollingFileAppender extends log4cxx::FileAppender to backup the log files depending on RollingPolicy and TriggeringPolicy.

To be of any use, a RollingFileAppender instance must have both a RollingPolicy and a TriggeringPolicy set up. However, if its RollingPolicy also implements the TriggeringPolicy interface, then only the former needs to be set up. For example, TimeBasedRollingPolicy acts both as a RollingPolicy and a TriggeringPolicy.

RollingFileAppender can be configured programattically or using log4cxx::xml::DOMConfigurator. Here is a sample configration file:

<?xml version="1.0" encoding="UTF-8" ?>
        <!DOCTYPE log4j:configuration>
        <log4j:configuration debug="true">
          <appender name="ROLL" class="org.apache.log4j.rolling.RollingFileAppender">
            <rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy">
              <param name="FileNamePattern" value="/wombat/foo.%d{yyyy-MM}.gz"/>
            </rollingPolicy>
            <layout class="org.apache.log4j.PatternLayout">
              <param name="ConversionPattern" value="%c{1} - %m%n"/>
            </layout>
          </appender>
          <root">
            &lt;appender-ref ref="ROLL"/>
          </root>
        </log4j:configuration>
        

This configuration file specifies a monthly rollover schedule including automatic compression of the archived files. See TimeBasedRollingPolicy for more details.


Constructor & Destructor Documentation


The documentation for this class was generated from the following file: