You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Aaron Goodisman (Jira)" <ji...@apache.org> on 2022/09/27 16:03:00 UTC
[jira] [Created] (LOG4J2-3610) IfLastModified age doesn't seem to support ISO-8601 durations fully
Aaron Goodisman created LOG4J2-3610:
---------------------------------------
Summary: IfLastModified age doesn't seem to support ISO-8601 durations fully
Key: LOG4J2-3610
URL: https://issues.apache.org/jira/browse/LOG4J2-3610
Project: Log4j 2
Issue Type: Bug
Components: Appenders
Affects Versions: 2.17.2
Environment: Tomcat 9.0.48
Java 1.8
Reporter: Aaron Goodisman
{code:java}
<DefaultRolloverStrategy>
<Delete basePath="${sys:logdirectory}" maxDepth="1">
<IfFileName glob="${sys:logprefix}-info-*.log">
<IfLastModified age="7D">
<IfAny>
<IfAccumulatedFileCount exceeds="1"/>
</IfAny>
</IfLastModified>
</IfFileName>
</Delete>
</DefaultRolloverStrategy>{code}
The above rollover strategy for a RollingFile appender appears to work correctly, and deletes log files matching the specification with an age over 7 days.
The [documentation|https://logging.apache.org/log4j/2.x/log4j-core/apidocs/org/apache/logging/log4j/core/appender/rolling/action/Duration.html#parse-java.lang.CharSequence-] suggests that the age can be specified using the [ISO-8601 duration|https://en.wikipedia.org/wiki/ISO_8601#Durations] format, however strings like 1Y and 1W don't seem to work. They generate a configuration error and subsequent NullPointerException.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)