I have a log4j2 rollingFileAppender, its definition is as follows:
<RollingFile name="safety"
fileName="${LOG_PATH}/server_${sys:id:-}.log"
filePattern="${LOG_PATH}/server_${sys:id:-}.log.gz"
ignoreExceptions="false">
<PatternLayout>
<Pattern>%d{yy-MM-dd HH:mm:ss.SSS} %-5p %t - %m%n</Pattern>
</PatternLayout>
<Policies>
<SizeBasedTriggeringPolicy size="50MB" />
</Policies>
<DefaultRolloverStrategy max="5">
<Delete basePath="${LOG_PATH}" maxDepth="1">
<IfFileName glob="*/app-*.log.gz" />
<IfLastModified age="P30D" />
</Delete>
</DefaultRolloverStrategy>
</RollingFile>
I think due to the delete tag being dysfunctional, it's making the not work as expected.
What did i try : There are other rollingFileAppnders as well that i have in the same file where we dont have the <delete> tag and it is working fine as expected
What was i expecting : I understand that the developer has written a wrong condition in the <IfFileName> tag inside the <delete> tag. But regardless of that at least according to me the files would have still rolled over, only that they wouldn't have been deleted.
Please correct me if my understanding is not correct (P.S: i am referring to Apache log4j2 doc https://logging.apache.org/log4j/2.x/manual/appenders.html#rollingfileappender )