Class IfAccumulatedFileSize
- java.lang.Object
-
- org.apache.logging.log4j.core.appender.rolling.action.IfAccumulatedFileSize
-
- All Implemented Interfaces:
PathCondition
@Plugin(name="IfAccumulatedFileSize", category="Core", printObject=true) public final class IfAccumulatedFileSize extends Object implements PathCondition
PathCondition that accepts paths after the accumulated file size threshold is exceeded during the file tree walk.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
accept(Path basePath, Path relativePath, BasicFileAttributes attrs)
Returnstrue
if the specified candidate path should be deleted,false
otherwise.void
beforeFileTreeWalk()
Invoked before a new file tree walk is started.static IfAccumulatedFileSize
createFileSizeCondition(String size, PathCondition... nestedConditions)
Create an IfAccumulatedFileSize condition.List<PathCondition>
getNestedConditions()
long
getThresholdBytes()
String
toString()
-
-
-
Method Detail
-
getThresholdBytes
public long getThresholdBytes()
-
getNestedConditions
public List<PathCondition> getNestedConditions()
-
accept
public boolean accept(Path basePath, Path relativePath, BasicFileAttributes attrs)
Description copied from interface:PathCondition
Returnstrue
if the specified candidate path should be deleted,false
otherwise.- Specified by:
accept
in 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:PathCondition
Invoked before a new file tree walk is started. Stateful PathConditions can reset their state when this method is called.- Specified by:
beforeFileTreeWalk
in interfacePathCondition
-
createFileSizeCondition
@PluginFactory public static IfAccumulatedFileSize createFileSizeCondition(@PluginAttribute("exceeds") String size, @PluginElement("PathConditions") PathCondition... nestedConditions)
Create an IfAccumulatedFileSize condition.- Parameters:
threshold
- The threshold accumulated file size from which files will be deleted.- Returns:
- An IfAccumulatedFileSize condition.
-
-