Class IfLastModified
java.lang.Object
org.apache.logging.log4j.core.appender.rolling.action.IfLastModified
- All Implemented Interfaces:
PathCondition
@Plugin(name="IfLastModified",
category="Core",
printObject=true)
public final class IfLastModified
extends Object
implements PathCondition
PathCondition that accepts paths that are older than the specified duration.
-
Field Summary
Fields inherited from interface org.apache.logging.log4j.core.appender.rolling.action.PathCondition
EMPTY_ARRAY
-
Method Summary
Modifier and TypeMethodDescriptionboolean
accept
(Path basePath, Path relativePath, BasicFileAttributes attrs) Returnstrue
if the specified candidate path should be deleted,false
otherwise.void
Invoked before a new file tree walk is started.static IfLastModified
createAgeCondition
(Duration age, PathCondition... nestedConditions) Create an IfLastModified condition.getAge()
toString()
-
Method Details
-
getAge
-
getNestedConditions
-
accept
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
-
createAgeCondition
@PluginFactory public static IfLastModified createAgeCondition(@PluginAttribute("age") @Required(message="No age provided for IfLastModified") Duration age, @PluginElement("PathConditions") PathCondition... nestedConditions) Create an IfLastModified condition.- Parameters:
age
- The path age that is accepted by this condition. Must be a valid Duration.nestedConditions
- nested conditions to evaluate if this condition accepts a path- Returns:
- An IfLastModified condition.
-
toString
-