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 java.lang.Object implements PathCondition
PathCondition that accepts paths that are older than the specified duration.- Since:
- 2.5
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classIfLastModified.Builder
-
Field Summary
Fields Modifier and Type Field Description private java.time.Durationageprivate static ClockCLOCKprivate static LoggerLOGGERprivate PathCondition[]nestedConditions-
Fields inherited from interface org.apache.logging.log4j.core.appender.rolling.action.PathCondition
EMPTY_ARRAY
-
-
Constructor Summary
Constructors Modifier Constructor Description privateIfLastModified(java.time.Duration age, PathCondition[] nestedConditions)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description booleanaccept(java.nio.file.Path basePath, java.nio.file.Path relativePath, java.nio.file.attribute.BasicFileAttributes attrs)Returnstrueif the specified candidate path should be deleted,falseotherwise.voidbeforeFileTreeWalk()Invoked before a new file tree walk is started.static IfLastModifiedcreateAgeCondition(Duration age, PathCondition... pathConditions)Deprecated.since 2.24.0 usenewBuilder()instead.DurationgetAge()Deprecated.since 2.24.0.java.util.List<PathCondition>getNestedConditions()static IfLastModified.BuildernewBuilder()java.lang.StringtoString()
-
-
-
Field Detail
-
LOGGER
private static final Logger LOGGER
-
CLOCK
private static final Clock CLOCK
-
age
private final java.time.Duration age
-
nestedConditions
private final PathCondition[] nestedConditions
-
-
Constructor Detail
-
IfLastModified
private IfLastModified(java.time.Duration age, PathCondition[] nestedConditions)
-
-
Method Detail
-
getAge
@Deprecated public Duration getAge()
Deprecated.since 2.24.0. In 3.0.0 the signature will change.
-
getNestedConditions
public java.util.List<PathCondition> getNestedConditions()
-
accept
public boolean accept(java.nio.file.Path basePath, java.nio.file.Path relativePath, java.nio.file.attribute.BasicFileAttributes attrs)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
-
createAgeCondition
@Deprecated public static IfLastModified createAgeCondition(Duration age, PathCondition... pathConditions)
Deprecated.since 2.24.0 usenewBuilder()instead.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
newBuilder
@PluginBuilderFactory public static IfLastModified.Builder newBuilder()
- Since:
- 2.24.0
-
-