Class DirectWriteRolloverStrategy

java.lang.Object
org.apache.logging.log4j.core.appender.rolling.AbstractRolloverStrategy
org.apache.logging.log4j.core.appender.rolling.DirectWriteRolloverStrategy
All Implemented Interfaces:
DirectFileRolloverStrategy, RolloverStrategy

@Plugin(name="DirectWriteRolloverStrategy", category="Core", printObject=true) public class DirectWriteRolloverStrategy extends AbstractRolloverStrategy implements DirectFileRolloverStrategy
When rolling over, DirectWriteRolloverStrategy writes directly to the file as resolved by the file pattern. Files will be renamed files according to an algorithm as described below.

The DirectWriteRolloverStrategy uses similar logic as DefaultRolloverStrategy to determine the file name based on the file pattern, however the DirectWriteRolloverStrategy writes directly to a file and does not rename it during rollover, except if it is compressed, in which case it will add the appropriate file extension.

Since:
2.8
  • Constructor Details

    • DirectWriteRolloverStrategy

      @Deprecated protected DirectWriteRolloverStrategy(int maxFiles, int compressionLevel, StrSubstitutor strSubstitutor, Action[] customActions, boolean stopCustomActionsOnError)
      Deprecated.
      Since 2.9 Added tempCompressedFilePatternString parameter
      Constructs a new instance.
      Parameters:
      maxFiles - The maximum number of files that match the date portion of the pattern to keep.
      customActions - custom actions to perform asynchronously after rollover
      stopCustomActionsOnError - whether to stop executing asynchronous actions if an error occurs
    • DirectWriteRolloverStrategy

      protected DirectWriteRolloverStrategy(int maxFiles, int compressionLevel, StrSubstitutor strSubstitutor, Action[] customActions, boolean stopCustomActionsOnError, String tempCompressedFilePatternString)
      Constructs a new instance.
      Parameters:
      maxFiles - The maximum number of files that match the date portion of the pattern to keep.
      customActions - custom actions to perform asynchronously after rollover
      stopCustomActionsOnError - whether to stop executing asynchronous actions if an error occurs
      tempCompressedFilePatternString - File pattern of the working file used during compression, if null no temporary file are used
  • Method Details