RollingFileAppender Class Reference

Inherits RollingFileAppenderSkeleton.

List of all members.


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} - mn"/>
            </layout>
          </appender>

          <root">
            <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.


Public Member Functions

 RollingFileAppender ()


Constructor & Destructor Documentation

RollingFileAppender  ) 
 


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