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

java.lang.Object
  extended by ch.qos.logback.core.spi.ContextAwareBase
      extended by 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
protected  ArchiveRemover archiveRemover
           
protected  long artificialCurrentTime
           
protected  Date dateInCurrentPeriod
           
protected  String elapsedPeriodsFileName
           
protected  long nextCheck
           
protected  RollingCalendar rc
           
protected  boolean started
           
protected  TimeBasedRollingPolicy<E> tbrp
           
 
Fields inherited from class ch.qos.logback.core.spi.ContextAwareBase
context
 
Constructor Summary
TimeBasedFileNamingAndTriggeringPolicyBase()
           
 
Method Summary
protected  void computeNextCheck()
           
 ArchiveRemover getArchiveRemover()
          Return the archive remover appropriate for this instance.
 String getCurrentPeriodsFileNameWithoutCompressionSuffix()
          Return the current periods file name without the compression suffix.
 long getCurrentTime()
          Return the current time which is usually the value returned by System.currentMillis().
 String getElapsedPeriodsFileName()
          Return the file name for the elapsed periods file name.
 boolean isStarted()
           
 void setCurrentTime(long timeInMillis)
          Set the current time.
 void setDateInCurrentPeriod(Date _dateInCurrentPeriod)
           
protected  void setDateInCurrentPeriod(long now)
           
 void setTimeBasedRollingPolicy(TimeBasedRollingPolicy<E> _tbrp)
          Set the host/parent TimeBasedRollingPolicy.
 void start()
           
 void stop()
           
 
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.rolling.TriggeringPolicy
isTriggeringEvent
 
Methods inherited from interface ch.qos.logback.core.spi.ContextAware
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, setContext
 

Field Detail

tbrp

protected TimeBasedRollingPolicy<E> tbrp

archiveRemover

protected ArchiveRemover archiveRemover

elapsedPeriodsFileName

protected String elapsedPeriodsFileName

rc

protected RollingCalendar rc

artificialCurrentTime

protected long artificialCurrentTime

dateInCurrentPeriod

protected Date dateInCurrentPeriod

nextCheck

protected long nextCheck

started

protected boolean started
Constructor Detail

TimeBasedFileNamingAndTriggeringPolicyBase

public TimeBasedFileNamingAndTriggeringPolicyBase()
Method Detail

isStarted

public boolean isStarted()
Specified by:
isStarted in interface LifeCycle

start

public void start()
Specified by:
start in interface LifeCycle

stop

public void stop()
Specified by:
stop in interface LifeCycle

computeNextCheck

protected void computeNextCheck()

setDateInCurrentPeriod

protected void setDateInCurrentPeriod(long now)

setDateInCurrentPeriod

public void setDateInCurrentPeriod(Date _dateInCurrentPeriod)

getElapsedPeriodsFileName

public String getElapsedPeriodsFileName()
Description copied from interface: TimeBasedFileNamingAndTriggeringPolicy
Return the file name for the elapsed periods file name.

Specified by:
getElapsedPeriodsFileName in interface TimeBasedFileNamingAndTriggeringPolicy<E>
Returns:

getCurrentPeriodsFileNameWithoutCompressionSuffix

public String getCurrentPeriodsFileNameWithoutCompressionSuffix()
Description copied from interface: TimeBasedFileNamingAndTriggeringPolicy
Return the current periods file name without the compression suffix. This value is equivalent to the active file name.

Specified by:
getCurrentPeriodsFileNameWithoutCompressionSuffix in interface TimeBasedFileNamingAndTriggeringPolicy<E>
Returns:
current period's file name (without compression suffix)

setCurrentTime

public void setCurrentTime(long timeInMillis)
Description copied from interface: TimeBasedFileNamingAndTriggeringPolicy
Set the current time. Only unit tests should invoke this method.

Specified by:
setCurrentTime in interface TimeBasedFileNamingAndTriggeringPolicy<E>

getCurrentTime

public long getCurrentTime()
Description copied from interface: TimeBasedFileNamingAndTriggeringPolicy
Return 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:
getCurrentTime in interface TimeBasedFileNamingAndTriggeringPolicy<E>
Returns:
current time value

setTimeBasedRollingPolicy

public void setTimeBasedRollingPolicy(TimeBasedRollingPolicy<E> _tbrp)
Description copied from interface: TimeBasedFileNamingAndTriggeringPolicy
Set the host/parent TimeBasedRollingPolicy.

Specified by:
setTimeBasedRollingPolicy in interface TimeBasedFileNamingAndTriggeringPolicy<E>
Parameters:
_tbrp - parent TimeBasedRollingPolicy

getArchiveRemover

public ArchiveRemover getArchiveRemover()
Description copied from interface: TimeBasedFileNamingAndTriggeringPolicy
Return the archive remover appropriate for this instance.

Specified by:
getArchiveRemover in interface TimeBasedFileNamingAndTriggeringPolicy<E>


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