Package ch.qos.logback.core.rolling
Class TimeBasedFileNamingAndTriggeringPolicyBase<E>
- java.lang.Object
-
- ch.qos.logback.core.spi.ContextAwareBase
-
- ch.qos.logback.core.rolling.TimeBasedFileNamingAndTriggeringPolicyBase<E>
-
- All Implemented Interfaces:
TimeBasedFileNamingAndTriggeringPolicy<E>,TriggeringPolicy<E>,ContextAware,LifeCycle
- Direct Known Subclasses:
DefaultTimeBasedFileNamingAndTriggeringPolicy,SizeAndTimeBasedFNATP
public abstract class TimeBasedFileNamingAndTriggeringPolicyBase<E> extends ContextAwareBase implements TimeBasedFileNamingAndTriggeringPolicy<E>
-
-
Field Summary
Fields Modifier and Type Field Description protected ArchiveRemoverarchiveRemoverprotected longartificialCurrentTimeprivate static java.lang.StringCOLLIDING_DATE_FORMAT_URLprotected java.util.DatedateInCurrentPeriodprotected java.lang.StringelapsedPeriodsFileNameprotected booleanerrorFreeprotected longnextCheckprotected RollingCalendarrcprotected booleanstartedprotected TimeBasedRollingPolicy<E>tbrp-
Fields inherited from class ch.qos.logback.core.spi.ContextAwareBase
context
-
-
Constructor Summary
Constructors Constructor Description TimeBasedFileNamingAndTriggeringPolicyBase()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcomputeNextCheck()ArchiveRemovergetArchiveRemover()Return the archive remover appropriate for this instance.java.lang.StringgetCurrentPeriodsFileNameWithoutCompressionSuffix()Return the current periods file name without the compression suffix.longgetCurrentTime()Return the current time which is usually the value returned by System.currentMillis().java.lang.StringgetElapsedPeriodsFileName()Return the file name for the elapsed periods file name.protected booleanisErrorFree()booleanisStarted()voidsetCurrentTime(long timeInMillis)Set the current time.protected voidsetDateInCurrentPeriod(long now)voidsetDateInCurrentPeriod(java.util.Date _dateInCurrentPeriod)voidsetTimeBasedRollingPolicy(TimeBasedRollingPolicy<E> _tbrp)Set the host/parentTimeBasedRollingPolicy.voidstart()voidstop()protected voidwithErrors()-
Methods inherited from class ch.qos.logback.core.spi.ContextAwareBase
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, getDeclaredOrigin, getStatusManager, setContext
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface ch.qos.logback.core.spi.ContextAware
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, setContext
-
Methods inherited from interface ch.qos.logback.core.rolling.TriggeringPolicy
isTriggeringEvent
-
-
-
-
Field Detail
-
COLLIDING_DATE_FORMAT_URL
private static java.lang.String COLLIDING_DATE_FORMAT_URL
-
tbrp
protected TimeBasedRollingPolicy<E> tbrp
-
archiveRemover
protected ArchiveRemover archiveRemover
-
elapsedPeriodsFileName
protected java.lang.String elapsedPeriodsFileName
-
rc
protected RollingCalendar rc
-
artificialCurrentTime
protected long artificialCurrentTime
-
dateInCurrentPeriod
protected java.util.Date dateInCurrentPeriod
-
nextCheck
protected long nextCheck
-
started
protected boolean started
-
errorFree
protected boolean errorFree
-
-
Method Detail
-
computeNextCheck
protected void computeNextCheck()
-
setDateInCurrentPeriod
protected void setDateInCurrentPeriod(long now)
-
setDateInCurrentPeriod
public void setDateInCurrentPeriod(java.util.Date _dateInCurrentPeriod)
-
getElapsedPeriodsFileName
public java.lang.String getElapsedPeriodsFileName()
Description copied from interface:TimeBasedFileNamingAndTriggeringPolicyReturn the file name for the elapsed periods file name.- Specified by:
getElapsedPeriodsFileNamein interfaceTimeBasedFileNamingAndTriggeringPolicy<E>- Returns:
-
getCurrentPeriodsFileNameWithoutCompressionSuffix
public java.lang.String getCurrentPeriodsFileNameWithoutCompressionSuffix()
Description copied from interface:TimeBasedFileNamingAndTriggeringPolicyReturn the current periods file name without the compression suffix. This value is equivalent to the active file name.- Specified by:
getCurrentPeriodsFileNameWithoutCompressionSuffixin interfaceTimeBasedFileNamingAndTriggeringPolicy<E>- Returns:
- current period's file name (without compression suffix)
-
setCurrentTime
public void setCurrentTime(long timeInMillis)
Description copied from interface:TimeBasedFileNamingAndTriggeringPolicySet the current time. Only unit tests should invoke this method.- Specified by:
setCurrentTimein interfaceTimeBasedFileNamingAndTriggeringPolicy<E>
-
getCurrentTime
public long getCurrentTime()
Description copied from interface:TimeBasedFileNamingAndTriggeringPolicyReturn the current time which is usually the value returned by System.currentMillis(). However, for testing purposed this value may be different than the real time.- Specified by:
getCurrentTimein interfaceTimeBasedFileNamingAndTriggeringPolicy<E>- Returns:
- current time value
-
setTimeBasedRollingPolicy
public void setTimeBasedRollingPolicy(TimeBasedRollingPolicy<E> _tbrp)
Description copied from interface:TimeBasedFileNamingAndTriggeringPolicySet the host/parentTimeBasedRollingPolicy.- Specified by:
setTimeBasedRollingPolicyin interfaceTimeBasedFileNamingAndTriggeringPolicy<E>- Parameters:
_tbrp- parent TimeBasedRollingPolicy
-
getArchiveRemover
public ArchiveRemover getArchiveRemover()
Description copied from interface:TimeBasedFileNamingAndTriggeringPolicyReturn the archive remover appropriate for this instance.- Specified by:
getArchiveRemoverin interfaceTimeBasedFileNamingAndTriggeringPolicy<E>
-
withErrors
protected void withErrors()
-
isErrorFree
protected boolean isErrorFree()
-
-