Logback API
Version 0.9.8

ch.qos.logback.core.rolling
Class RollingFileAppender<E>

java.lang.Object
  extended by ch.qos.logback.core.spi.ContextAwareBase
      extended by ch.qos.logback.core.AppenderBase<E>
          extended by ch.qos.logback.core.WriterAppender<E>
              extended by ch.qos.logback.core.FileAppender<E>
                  extended by ch.qos.logback.core.rolling.RollingFileAppender<E>
All Implemented Interfaces:
Appender<E>, ContextAware, FilterAttachable, LifeCycle

public class RollingFileAppender<E>
extends FileAppender<E>

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

For more information about this appender, please refer to the online manual at http://logback.qos.ch/manual/appenders.html#RollingFileAppender

Since:
1.3
Author:
Heinz Richter, Ceki Gülcü

Field Summary
 
Fields inherited from class ch.qos.logback.core.FileAppender
append, bufferedIO, bufferSize, fileName
 
Fields inherited from class ch.qos.logback.core.WriterAppender
encoding, immediateFlush, layout, writer
 
Fields inherited from class ch.qos.logback.core.AppenderBase
name, started
 
Fields inherited from class ch.qos.logback.core.spi.ContextAwareBase
context
 
Constructor Summary
RollingFileAppender()
          The default constructor simply calls its parents constructor.
 
Method Summary
 RollingPolicy getRollingPolicy()
           
 TriggeringPolicy getTriggeringPolicy()
           
 void rollover()
          Implements the usual roll over behaviour.
 void setRollingPolicy(RollingPolicy policy)
          Sets the rolling policy.
 void setTriggeringPolicy(TriggeringPolicy policy)
           
 void start()
          If the value of File is not null, then FileAppender.setFile(java.lang.String) is called with the values of File and Append properties.
protected  void subAppend(E event)
          This method differentiates RollingFileAppender from its super class.
 
Methods inherited from class ch.qos.logback.core.FileAppender
getAppend, getBufferSize, getFile, isBufferedIO, setAppend, setBufferedIO, setBufferSize, setFile, setFile
 
Methods inherited from class ch.qos.logback.core.WriterAppender
append, closeWriter, createWriter, getEncoding, getImmediateFlush, getLayout, setEncoding, setImmediateFlush, setLayout, setWriter, stop
 
Methods inherited from class ch.qos.logback.core.AppenderBase
addFilter, clearAllFilters, doAppend, getFilterChainDecision, getFirstFilter, getName, isStarted, setName, toString
 
Methods inherited from class ch.qos.logback.core.spi.ContextAwareBase
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, getStatusManager, setContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface ch.qos.logback.core.spi.ContextAware
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, setContext
 

Constructor Detail

RollingFileAppender

public RollingFileAppender()
The default constructor simply calls its parents constructor.

Method Detail

start

public void start()
Description copied from class: FileAppender
If the value of File is not null, then FileAppender.setFile(java.lang.String) is called with the values of File and Append properties.

Specified by:
start in interface LifeCycle
Overrides:
start in class FileAppender<E>

rollover

public void rollover()
Implements the usual roll over behaviour.

If MaxBackupIndex is positive, then files {File.1, ..., File.MaxBackupIndex -1} are renamed to {File.2, ..., File.MaxBackupIndex}. Moreover, File is renamed File.1 and closed. A new File is created to receive further log output.

If MaxBackupIndex is equal to zero, then the File is truncated with no backup files created.


subAppend

protected void subAppend(E event)
This method differentiates RollingFileAppender from its super class.

Overrides:
subAppend in class WriterAppender<E>

getRollingPolicy

public RollingPolicy getRollingPolicy()

getTriggeringPolicy

public TriggeringPolicy getTriggeringPolicy()

setRollingPolicy

public void setRollingPolicy(RollingPolicy policy)
Sets the rolling policy. In case the 'policy' argument also implements TriggeringPolicy, then the triggering policy for this appender is automatically set to be the policy argument.

Parameters:
policy -

setTriggeringPolicy

public void setTriggeringPolicy(TriggeringPolicy policy)

Logback API
Version 0.9.8

Copyright © 2005-2008 QOS.ch. All Rights Reserved.