Class DefaultRolloverStrategy.Builder
- java.lang.Object
-
- org.apache.logging.log4j.core.appender.rolling.DefaultRolloverStrategy.Builder
-
- All Implemented Interfaces:
Builder<DefaultRolloverStrategy>
- Enclosing class:
- DefaultRolloverStrategy
public static class DefaultRolloverStrategy.Builder extends java.lang.Object implements Builder<DefaultRolloverStrategy>
Builds DefaultRolloverStrategy instances.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
compressionLevelStr
private Configuration
config
private Action[]
customActions
private java.lang.String
fileIndex
private java.lang.String
max
private java.lang.String
min
private boolean
stopCustomActionsOnError
private java.lang.String
tempCompressedFilePattern
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DefaultRolloverStrategy
build()
Builds the object after all configuration has been set.java.lang.String
getCompressionLevelStr()
Configuration
getConfig()
Action[]
getCustomActions()
java.lang.String
getFileIndex()
java.lang.String
getMax()
java.lang.String
getMin()
java.lang.String
getTempCompressedFilePattern()
boolean
isStopCustomActionsOnError()
DefaultRolloverStrategy.Builder
withCompressionLevelStr(java.lang.String compressionLevelStr)
Defines compression level.DefaultRolloverStrategy.Builder
withConfig(Configuration config)
Defines configuration.DefaultRolloverStrategy.Builder
withCustomActions(Action[] customActions)
Defines custom actions.DefaultRolloverStrategy.Builder
withFileIndex(java.lang.String fileIndex)
Defines the file index for rolling strategy.DefaultRolloverStrategy.Builder
withMax(java.lang.String max)
Defines the maximum number of files to keep.DefaultRolloverStrategy.Builder
withMin(java.lang.String min)
Defines the minimum number of files to keep.DefaultRolloverStrategy.Builder
withStopCustomActionsOnError(boolean stopCustomActionsOnError)
Defines whether to stop executing asynchronous actions if an error occurs.DefaultRolloverStrategy.Builder
withTempCompressedFilePattern(java.lang.String tempCompressedFilePattern)
Defines temporary compression file pattern.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.logging.log4j.core.util.Builder
getErrorPrefix, isValid
-
-
-
-
Field Detail
-
max
@PluginBuilderAttribute("max") private java.lang.String max
-
min
@PluginBuilderAttribute("min") private java.lang.String min
-
fileIndex
@PluginBuilderAttribute("fileIndex") private java.lang.String fileIndex
-
compressionLevelStr
@PluginBuilderAttribute("compressionLevel") private java.lang.String compressionLevelStr
-
customActions
@PluginElement("Actions") private Action[] customActions
-
stopCustomActionsOnError
@PluginBuilderAttribute("stopCustomActionsOnError") private boolean stopCustomActionsOnError
-
tempCompressedFilePattern
@PluginBuilderAttribute("tempCompressedFilePattern") private java.lang.String tempCompressedFilePattern
-
config
@PluginConfiguration private Configuration config
-
-
Method Detail
-
build
public DefaultRolloverStrategy build()
Description copied from interface:Builder
Builds the object after all configuration has been set. This will use default values for any unspecified attributes for the object.- Specified by:
build
in interfaceBuilder<DefaultRolloverStrategy>
- Returns:
- the configured instance.
-
getMax
public java.lang.String getMax()
-
withMax
public DefaultRolloverStrategy.Builder withMax(java.lang.String max)
Defines the maximum number of files to keep.- Parameters:
max
- The maximum number of files to keep.- Returns:
- This builder for chaining convenience
-
getMin
public java.lang.String getMin()
-
withMin
public DefaultRolloverStrategy.Builder withMin(java.lang.String min)
Defines the minimum number of files to keep.- Parameters:
min
- The minimum number of files to keep.- Returns:
- This builder for chaining convenience
-
getFileIndex
public java.lang.String getFileIndex()
-
withFileIndex
public DefaultRolloverStrategy.Builder withFileIndex(java.lang.String fileIndex)
Defines the file index for rolling strategy.- Parameters:
fileIndex
- If set to "max" (the default), files with a higher index will be newer than files with a smaller index. If set to "min", file renaming and the counter will follow the Fixed Window strategy.- Returns:
- This builder for chaining convenience
-
getCompressionLevelStr
public java.lang.String getCompressionLevelStr()
-
withCompressionLevelStr
public DefaultRolloverStrategy.Builder withCompressionLevelStr(java.lang.String compressionLevelStr)
Defines compression level.- Parameters:
compressionLevelStr
- The compression level, 0 (less) through 9 (more); applies only to ZIP files.- Returns:
- This builder for chaining convenience
-
getCustomActions
public Action[] getCustomActions()
-
withCustomActions
public DefaultRolloverStrategy.Builder withCustomActions(Action[] customActions)
Defines custom actions.- Parameters:
customActions
- custom actions to perform asynchronously after rollover- Returns:
- This builder for chaining convenience
-
isStopCustomActionsOnError
public boolean isStopCustomActionsOnError()
-
withStopCustomActionsOnError
public DefaultRolloverStrategy.Builder withStopCustomActionsOnError(boolean stopCustomActionsOnError)
Defines whether to stop executing asynchronous actions if an error occurs.- Parameters:
stopCustomActionsOnError
- whether to stop executing asynchronous actions if an error occurs- Returns:
- This builder for chaining convenience
-
getTempCompressedFilePattern
public java.lang.String getTempCompressedFilePattern()
-
withTempCompressedFilePattern
public DefaultRolloverStrategy.Builder withTempCompressedFilePattern(java.lang.String tempCompressedFilePattern)
Defines temporary compression file pattern.- Parameters:
tempCompressedFilePattern
- File pattern of the working file pattern used during compression, if null no temporary file are used- Returns:
- This builder for chaining convenience
-
getConfig
public Configuration getConfig()
-
withConfig
public DefaultRolloverStrategy.Builder withConfig(Configuration config)
Defines configuration.- Parameters:
config
- The Configuration.- Returns:
- This builder for chaining convenience
-
-