Class CustomSizeAndTimeBasedArchiveRemover

java.lang.Object
ch.qos.logback.core.spi.ContextAwareBase
ch.qos.logback.core.rolling.helper.TimeBasedArchiveRemover
ch.qos.logback.core.rolling.helper.SizeAndTimeBasedArchiveRemover
ch.qos.logback.core.rolling.helper.CustomSizeAndTimeBasedArchiveRemover
All Implemented Interfaces:
ch.qos.logback.core.rolling.helper.ArchiveRemover, ch.qos.logback.core.spi.ContextAware

public class CustomSizeAndTimeBasedArchiveRemover extends ch.qos.logback.core.rolling.helper.SizeAndTimeBasedArchiveRemover
This is a customization of the SizeAndTimeBasedArchiveRemover to enforce total size on each clean and to count all files not just periods.
Since:
1.16.1
Author:
Ville Koskela (ville dot koskela at inscopemetrics dot io)
  • Nested Class Summary

    Nested classes/interfaces inherited from class ch.qos.logback.core.rolling.helper.TimeBasedArchiveRemover

    ch.qos.logback.core.rolling.helper.TimeBasedArchiveRemover.ArhiveRemoverRunnable
  • Field Summary

    Fields inherited from class ch.qos.logback.core.rolling.helper.SizeAndTimeBasedArchiveRemover

    NO_INDEX

    Fields inherited from class ch.qos.logback.core.rolling.helper.TimeBasedArchiveRemover

    INACTIVITY_TOLERANCE_IN_MILLIS, UNINITIALIZED

    Fields inherited from class ch.qos.logback.core.spi.ContextAwareBase

    context
  • Constructor Summary

    Constructors
    Constructor
    Description
    CustomSizeAndTimeBasedArchiveRemover(ch.qos.logback.core.rolling.helper.FileNamePattern fileNamePattern, ch.qos.logback.core.rolling.helper.RollingCalendar rollingCalendar)
    Public constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    void
    setMaxHistory(int maxHistory)
     
    void
    setTotalSizeCap(long totalSizeCap)
     

    Methods inherited from class ch.qos.logback.core.rolling.helper.SizeAndTimeBasedArchiveRemover

    descendingSort, getFilesInPeriod

    Methods inherited from class ch.qos.logback.core.rolling.helper.TimeBasedArchiveRemover

    cleanAsynchronously, cleanPeriod, getPeriodOffsetForDeletionTarget, toString

    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
  • Constructor Details

    • CustomSizeAndTimeBasedArchiveRemover

      public CustomSizeAndTimeBasedArchiveRemover(ch.qos.logback.core.rolling.helper.FileNamePattern fileNamePattern, ch.qos.logback.core.rolling.helper.RollingCalendar rollingCalendar)
      Public constructor.
      Parameters:
      fileNamePattern - The FileNamePattern from the TimeBasedRollingPolicy.
      rollingCalendar - The RollingCalendar from the SizeAndTimeBasedFNATP.
  • Method Details

    • clean

      public void clean(Instant now)
      Specified by:
      clean in interface ch.qos.logback.core.rolling.helper.ArchiveRemover
      Overrides:
      clean in class ch.qos.logback.core.rolling.helper.TimeBasedArchiveRemover
    • setTotalSizeCap

      public void setTotalSizeCap(long totalSizeCap)
      Specified by:
      setTotalSizeCap in interface ch.qos.logback.core.rolling.helper.ArchiveRemover
      Overrides:
      setTotalSizeCap in class ch.qos.logback.core.rolling.helper.TimeBasedArchiveRemover
    • setMaxHistory

      public void setMaxHistory(int maxHistory)
      Specified by:
      setMaxHistory in interface ch.qos.logback.core.rolling.helper.ArchiveRemover
      Overrides:
      setMaxHistory in class ch.qos.logback.core.rolling.helper.TimeBasedArchiveRemover