Class TailFriendlyRollingPolicy<E>

java.lang.Object
ch.qos.logback.core.spi.ContextAwareBase
ch.qos.logback.core.rolling.RollingPolicyBase
ch.qos.logback.core.rolling.TimeBasedRollingPolicy<E>
edu.wisc.ssec.mcidasv.util.TailFriendlyRollingPolicy<E>
All Implemented Interfaces:
ch.qos.logback.core.rolling.RollingPolicy, ch.qos.logback.core.rolling.TriggeringPolicy<E>, ch.qos.logback.core.spi.ContextAware, ch.qos.logback.core.spi.LifeCycle

public class TailFriendlyRollingPolicy<E> extends ch.qos.logback.core.rolling.TimeBasedRollingPolicy<E>
This Logback "rolling policy" copies the contents of a log file (in this case, mcidasv.log) to the specified destination, and then "zeroes out" the original log file. This approach allows McIDAS-V users to run a command like "tail -f mcidasv.log" without any issue. Even on Windows.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) Future<?>
     

    Fields inherited from class ch.qos.logback.core.rolling.TimeBasedRollingPolicy

    totalSizeCap

    Fields inherited from class ch.qos.logback.core.rolling.RollingPolicyBase

    compressionMode, fileNamePatternStr

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

    context
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    (package private) Future<?>
    asyncCompress(String uncompressedPath, String compressedPath, String innerEntryName)
     
    private static boolean
    isFileEmpty(String filepath)
    Determine if the file at the given path is zero length.
    void
    Copies the contents of src into target, and then "zeroes out" src.
    (package private) Future<?>
    renamedRawAndAsyncCompress(String nameOfCompressedFile, String innerEntryName)
     
    void
     

    Methods inherited from class ch.qos.logback.core.rolling.TimeBasedRollingPolicy

    getActiveFileName, getMaxHistory, getTimeBasedFileNamingAndTriggeringPolicy, isCleanHistoryOnStart, isTriggeringEvent, isUnboundedTotalSizeCap, setCleanHistoryOnStart, setMaxHistory, setTimeBasedFileNamingAndTriggeringPolicy, setTotalSizeCap, start, stop, toString

    Methods inherited from class ch.qos.logback.core.rolling.RollingPolicyBase

    determineCompressionMode, getCompressionMode, getFileNamePattern, getParentsRawFileProperty, isParentPrudent, isStarted, setFileNamePattern, setParent

    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.LifeCycle

    isStarted
  • Field Details

  • Constructor Details

  • Method Details

    • rollover

      public void rollover() throws ch.qos.logback.core.rolling.RolloverFailure
      Specified by:
      rollover in interface ch.qos.logback.core.rolling.RollingPolicy
      Overrides:
      rollover in class ch.qos.logback.core.rolling.TimeBasedRollingPolicy<E>
      Throws:
      ch.qos.logback.core.rolling.RolloverFailure
    • asyncCompress

      Future<?> asyncCompress(String uncompressedPath, String compressedPath, String innerEntryName) throws ch.qos.logback.core.rolling.RolloverFailure
      Throws:
      ch.qos.logback.core.rolling.RolloverFailure
    • renamedRawAndAsyncCompress

      Future<?> renamedRawAndAsyncCompress(String nameOfCompressedFile, String innerEntryName) throws ch.qos.logback.core.rolling.RolloverFailure
      Throws:
      ch.qos.logback.core.rolling.RolloverFailure
    • renameByCopying

      public void renameByCopying(String src, String target) throws ch.qos.logback.core.rolling.RolloverFailure
      Copies the contents of src into target, and then "zeroes out" src.
      Parameters:
      src - Path to the file to be copied. Cannot be null.
      target - Path to the destination file. Cannot be null.
      Throws:
      ch.qos.logback.core.rolling.RolloverFailure - if copying failed.
    • isFileEmpty

      private static boolean isFileEmpty(String filepath)
      Determine if the file at the given path is zero length.
      Parameters:
      filepath - Path to the file to be tested. Cannot be null.
      Returns:
      true if filepath exists and is empty.