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

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

    [ https://issues.apache.org/jira/browse/LOG4J2-2685?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16919829#comment-16919829 ] 

Ralph Goers commented on LOG4J2-2685:
-------------------------------------

Originally, RollingFileManager did not support changing the triggering policy or rollover strategy.  I would agree that the pattern processor has to be updated first as it is critical for the triggering policy to know what to do. However, I have no idea what side effect that might have. It would need to be tested.

> 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
>            Priority: Blocker
>         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)