You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "gaurav (Jira)" <ji...@apache.org> on 2019/08/30 12:40:00 UTC

[jira] [Created] (LOG4J2-2685) Automatic Reconfiguration fails in case of change in the triggeringpolicy

gaurav created LOG4J2-2685:
------------------------------

             Summary: Automatic Reconfiguration fails in case of change in the triggeringpolicy
                 Key: LOG4J2-2685
                 URL: https://issues.apache.org/jira/browse/LOG4J2-2685
             Project: Log4j 2
          Issue Type: Bug
          Components: Core
    Affects Versions: 2.12.0
         Environment: Windows 10 + Tomcat 8.5 + Log4j2
            Reporter: gaurav
         Attachments: log4j2.xml, stacktrace.log

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 for your reference.

Please assist with the issue.

Thanks



--
This message was sent by Atlassian Jira
(v8.3.2#803003)