Package ch.qos.logback.core.rolling
Class RollingFileAppender<E>
java.lang.Object
ch.qos.logback.core.spi.ContextAwareBase
ch.qos.logback.core.UnsynchronizedAppenderBase<E>
ch.qos.logback.core.OutputStreamAppender<E>
ch.qos.logback.core.FileAppender<E>
ch.qos.logback.core.rolling.RollingFileAppender<E>
- All Implemented Interfaces:
Appender<E>,ContextAware,FilterAttachable<E>,LifeCycle
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-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static String(package private) Fileprivate static Stringprivate static Stringprivate static String(package private) RollingPolicy(package private) TriggeringPolicy<E> Fields inherited from class ch.qos.logback.core.FileAppender
append, COLLISION_WITH_EARLIER_APPENDER_URL, DEFAULT_BUFFER_SIZE, fileNameFields inherited from class ch.qos.logback.core.OutputStreamAppender
encoder, lockFields inherited from class ch.qos.logback.core.UnsynchronizedAppenderBase
name, startedFields inherited from class ch.qos.logback.core.spi.ContextAwareBase
context -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidprivate voidprivate booleanprivate booleangetFile()Returns the value of the File property.private booleaninnerCheckForFileNamePatternCollisionInPreviousRFA(FileNamePattern fileNamePattern) voidrollover()Implemented by delegating most of the rollover work to a rolling policy.voidThe File property takes a string value which should be the name of the file to append to.voidsetRollingPolicy(RollingPolicy policy) Sets the rolling policy.voidsetTriggeringPolicy(TriggeringPolicy<E> policy) voidstart()If the value of File is notnull, thenFileAppender.openFile(java.lang.String)is called with the values of File and Append properties.voidstop()Stop this appender instance.protected voidThis method differentiates RollingFileAppender from its super class.Methods inherited from class ch.qos.logback.core.FileAppender
addErrorForCollision, checkForFileCollisionInPreviousFileAppenders, isAppend, isPrudent, openFile, rawFileProperty, setAppend, setBufferSize, setPrudent, writeOutMethods inherited from class ch.qos.logback.core.OutputStreamAppender
append, closeOutputStream, getEncoder, getOutputStream, isImmediateFlush, setEncoder, setImmediateFlush, setLayout, setOutputStreamMethods inherited from class ch.qos.logback.core.UnsynchronizedAppenderBase
addFilter, clearAllFilters, doAppend, getCopyOfAttachedFiltersList, getFilterChainDecision, getName, isStarted, setName, toStringMethods inherited from class ch.qos.logback.core.spi.ContextAwareBase
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, getDeclaredOrigin, getStatusManager, setContextMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface ch.qos.logback.core.spi.ContextAware
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, setContext
-
Field Details
-
currentlyActiveFile
File currentlyActiveFile -
triggeringPolicy
TriggeringPolicy<E> triggeringPolicy -
rollingPolicy
RollingPolicy rollingPolicy -
RFA_NO_TP_URL
-
RFA_NO_RP_URL
-
COLLISION_URL
-
RFA_LATE_FILE_URL
-
-
Constructor Details
-
RollingFileAppender
public RollingFileAppender()
-
-
Method Details
-
start
public void start()Description copied from class:FileAppenderIf the value of File is notnull, thenFileAppender.openFile(java.lang.String)is called with the values of File and Append properties.- Specified by:
startin interfaceLifeCycle- Overrides:
startin classFileAppender<E>
-
checkForFileAndPatternCollisions
private boolean checkForFileAndPatternCollisions() -
checkForCollisionsInPreviousRollingFileAppenders
private boolean checkForCollisionsInPreviousRollingFileAppenders() -
innerCheckForFileNamePatternCollisionInPreviousRFA
-
stop
public void stop()Description copied from class:OutputStreamAppenderStop this appender instance. The underlying stream or writer is also closed.Stopped appenders cannot be reused.
- Specified by:
stopin interfaceLifeCycle- Overrides:
stopin classFileAppender<E>
-
setFile
Description copied from class:FileAppenderThe File property takes a string value which should be the name of the file to append to.- Overrides:
setFilein classFileAppender<E>
-
getFile
Description copied from class:FileAppenderReturns the value of the File property.This method may be overridden by derived classes.
- Overrides:
getFilein classFileAppender<E>
-
rollover
public void rollover()Implemented by delegating most of the rollover work to a rolling policy. -
attemptOpenFile
private void attemptOpenFile() -
attemptRollover
private void attemptRollover() -
subAppend
This method differentiates RollingFileAppender from its super class.- Overrides:
subAppendin classOutputStreamAppender<E>
-
getRollingPolicy
-
getTriggeringPolicy
-
setRollingPolicy
Sets the rolling policy. In case the 'policy' argument also implementsTriggeringPolicy, then the triggering policy for this appender is automatically set to be the policy argument.- Parameters:
policy-
-
setTriggeringPolicy
-