@Plugin(name="DirectWriteRolloverStrategy", category="Core", printObject=true) public class DirectWriteRolloverStrategy extends AbstractRolloverStrategy implements DirectFileRolloverStrategy
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.
LOGGER, strSubstitutor
Modifier | Constructor and Description |
---|---|
protected |
DirectWriteRolloverStrategy(int maxFiles,
int compressionLevel,
StrSubstitutor strSubstitutor,
Action[] customActions,
boolean stopCustomActionsOnError)
Constructs a new instance.
|
Modifier and Type | Method and Description |
---|---|
static DirectWriteRolloverStrategy |
createStrategy(String maxFiles,
String compressionLevelStr,
Action[] customActions,
boolean stopCustomActionsOnError,
Configuration config)
Creates the DirectWriteRolloverStrategy.
|
int |
getCompressionLevel() |
String |
getCurrentFileName(RollingFileManager manager) |
List<Action> |
getCustomActions() |
int |
getMaxFiles() |
boolean |
isStopCustomActionsOnError() |
RolloverDescription |
rollover(RollingFileManager manager)
Performs the rollover.
|
String |
toString() |
getEligibleFiles, getEligibleFiles, getEligibleFiles, getEligibleFiles, getStrSubstitutor, merge, suffixLength
protected DirectWriteRolloverStrategy(int maxFiles, int compressionLevel, StrSubstitutor strSubstitutor, Action[] customActions, boolean stopCustomActionsOnError)
maxFiles
- The minimum index.customActions
- custom actions to perform asynchronously after rolloverstopCustomActionsOnError
- whether to stop executing asynchronous actions if an error occurs@PluginFactory public static DirectWriteRolloverStrategy createStrategy(@PluginAttribute(value="maxFiles") String maxFiles, @PluginAttribute(value="compressionLevel") String compressionLevelStr, @PluginElement(value="Actions") Action[] customActions, @PluginAttribute(value="stopCustomActionsOnError",defaultBoolean=true) boolean stopCustomActionsOnError, @PluginConfiguration Configuration config)
maxFiles
- The maximum number of files that match the date portion of the pattern to keep.compressionLevelStr
- The compression level, 0 (less) through 9 (more); applies only to ZIP files.customActions
- custom actions to perform asynchronously after rolloverstopCustomActionsOnError
- whether to stop executing asynchronous actions if an error occursconfig
- The Configuration.public int getCompressionLevel()
public int getMaxFiles()
public boolean isStopCustomActionsOnError()
public String getCurrentFileName(RollingFileManager manager)
getCurrentFileName
in interface DirectFileRolloverStrategy
public RolloverDescription rollover(RollingFileManager manager) throws SecurityException
rollover
in interface RolloverStrategy
manager
- The RollingFileManager name for current active log file.SecurityException
- if an error occurs.Copyright © 1999-2017 The Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.