- java.lang.Object
-
- ch.qos.logback.core.spi.ContextAwareBase
-
- ch.qos.logback.core.rolling.helper.TimeBasedArchiveRemover
-
- All Implemented Interfaces:
ArchiveRemover,ContextAware
- Direct Known Subclasses:
SizeAndTimeBasedArchiveRemover
public class TimeBasedArchiveRemover extends ContextAwareBase implements ArchiveRemover
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classTimeBasedArchiveRemover.ArchiveRemoverRunnable
-
Field Summary
Fields Modifier and Type Field Description protected static longINACTIVITY_TOLERANCE_IN_MILLISprotected static longUNINITIALIZED-
Fields inherited from class ch.qos.logback.core.spi.ContextAwareBase
context
-
-
Constructor Summary
Constructors Constructor Description TimeBasedArchiveRemover(FileNamePattern fileNamePattern, FileNamePattern fileNamePatternWithoutCompSuffix, RollingCalendar rc)TimeBasedArchiveRemover(FileNamePattern fileNamePattern, RollingCalendar rc)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclean(Instant now)Called from the cleaning thread.Future<?>cleanAsynchronously(Instant now)voidcleanPeriod(Instant instantOfPeriodToClean)protected voiddescendingSort(File[] matchingFileArray, Instant instant)protected File[]getFilesInPeriod(Instant instantOfPeriodToClean)protected intgetPeriodOffsetForDeletionTarget()protected File[]getUncompressedFilesInPeriod(Instant instantOfPeriodToClean)Returns files of the given period which were not compressed, e.g. because the application was down at rollover time.voidsetMaxHistory(int maxHistory)voidsetTotalSizeCap(long totalSizeCap)StringtoString()-
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, wait, wait, wait
-
Methods inherited from interface ch.qos.logback.core.spi.ContextAware
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, setContext
-
-
-
-
Field Detail
-
UNINITIALIZED
protected static final long UNINITIALIZED
- See Also:
- Constant Field Values
-
INACTIVITY_TOLERANCE_IN_MILLIS
protected static final long INACTIVITY_TOLERANCE_IN_MILLIS
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
TimeBasedArchiveRemover
public TimeBasedArchiveRemover(FileNamePattern fileNamePattern, RollingCalendar rc)
-
TimeBasedArchiveRemover
public TimeBasedArchiveRemover(FileNamePattern fileNamePattern, FileNamePattern fileNamePatternWithoutCompSuffix, RollingCalendar rc)
- Parameters:
fileNamePattern- the pattern of archived filesfileNamePatternWithoutCompSuffix- the same pattern without the compression suffix, may be null. Uncompressed files matching this pattern are removed along with archived files.rc- the rolling calendar- Since:
- 1.7.0
-
-
Method Detail
-
cleanAsynchronously
public Future<?> cleanAsynchronously(Instant now)
- Specified by:
cleanAsynchronouslyin interfaceArchiveRemover
-
clean
public void clean(Instant now)
Called from the cleaning thread.- Specified by:
cleanin interfaceArchiveRemover- Parameters:
now-
-
getFilesInPeriod
protected File[] getFilesInPeriod(Instant instantOfPeriodToClean)
-
getUncompressedFilesInPeriod
protected File[] getUncompressedFilesInPeriod(Instant instantOfPeriodToClean)
Returns files of the given period which were not compressed, e.g. because the application was down at rollover time. Returns an empty array if there is no compression.Only called for periods older than maxHistory. Such files are neither the active file nor being compressed.
- Since:
- 1.7.0
-
cleanPeriod
public void cleanPeriod(Instant instantOfPeriodToClean)
-
descendingSort
protected void descendingSort(File[] matchingFileArray, Instant instant)
-
setMaxHistory
public void setMaxHistory(int maxHistory)
- Specified by:
setMaxHistoryin interfaceArchiveRemover
-
getPeriodOffsetForDeletionTarget
protected int getPeriodOffsetForDeletionTarget()
-
setTotalSizeCap
public void setTotalSizeCap(long totalSizeCap)
- Specified by:
setTotalSizeCapin interfaceArchiveRemover
-
-