Class IfAccumulatedFileCount
java.lang.Object
org.apache.logging.log4j.core.appender.rolling.action.IfAccumulatedFileCount
- All Implemented Interfaces:
PathCondition
@Plugin(name="IfAccumulatedFileCount",
category="Core",
printObject=true)
public final class IfAccumulatedFileCount
extends Object
implements PathCondition
PathCondition that accepts paths after some count threshold is exceeded during the file tree walk.
-
Field Summary
Fields inherited from interface org.apache.logging.log4j.core.appender.rolling.action.PathCondition
EMPTY_ARRAY -
Method Summary
Modifier and TypeMethodDescriptionbooleanaccept(Path basePath, Path relativePath, BasicFileAttributes attrs) Returnstrueif the specified candidate path should be deleted,falseotherwise.voidInvoked before a new file tree walk is started.static IfAccumulatedFileCountcreateFileCountCondition(int threshold, PathCondition... nestedConditions) Create an IfAccumulatedFileCount condition.inttoString()
-
Method Details
-
getThresholdCount
public int getThresholdCount() -
getNestedConditions
-
accept
Description copied from interface:PathConditionReturnstrueif the specified candidate path should be deleted,falseotherwise.- Specified by:
acceptin interfacePathCondition- Parameters:
basePath- the directory from where to start scanning for deletion candidate filesrelativePath- the candidate for deletion. This path is relative to the baseDir.attrs- attributes of the candidate path- Returns:
- whether the candidate path should be deleted
-
beforeFileTreeWalk
public void beforeFileTreeWalk()Description copied from interface:PathConditionInvoked before a new file tree walk is started. Stateful PathConditions can reset their state when this method is called.- Specified by:
beforeFileTreeWalkin interfacePathCondition
-
createFileCountCondition
@PluginFactory public static IfAccumulatedFileCount createFileCountCondition(@PluginAttribute(value="exceeds",defaultInt=2147483647) int threshold, @PluginElement("PathConditions") PathCondition... nestedConditions) Create an IfAccumulatedFileCount condition.- Parameters:
threshold- The threshold count from which files will be deleted.- Returns:
- An IfAccumulatedFileCount condition.
-
toString
-