You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@logging.apache.org by Gaurav <ga...@gmail.com> on 2019/08/30 12:41:02 UTC

[LOG4J2-2685] - Automatic Reconfiguration fails in case of change in the triggeringpolicy

Hi all,

I'm using log4j2 in a web app. I'm using RollingFileAppender and monitorInterval.

The automatic reconfiguration fails with the following exception:

java.lang.IllegalStateException: Pattern does not contain a date

Steps:-

Change filePattern from "${web:rootDir}/server.%i.log" to "${web:rootDir}/server.log.%d{yyyy-MM-dd}"
Remove <SizeBasedTriggeringPolicy size="2MB"/> from <Policies> and add <TimeBasedTriggeringPolicy interval="1"/>
Save log4j2.xml
What I suspect?

The RollingFileManager sets the triggering policy first and then sets the patternprocessor.

While setting the triggering policy, it uses the old pattern which does not contain the RolloverFrequency. So, it throws IllegalStateException with the message

"Pattern does not contain a date".

Possible solution?

In the updateData() of RollingFileManager, set the new pattern processor first and then set the triggering policy.

I have also attached my log4j2.xml and the stacktrace of the error in the JIRA ticket.

Please assist with the issue.

Thanks