You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@logging.apache.org by "Ralph Goers (JIRA)" <ji...@apache.org> on 2017/08/23 13:56:00 UTC

[jira] [Resolved] (LOG4J2-2024) TimeBasedTriggeringPolicy not work if no log written in the next hour

     [ https://issues.apache.org/jira/browse/LOG4J2-2024?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ralph Goers resolved LOG4J2-2024.
---------------------------------
    Resolution: Not A Bug

By design, TimeBasedTriggeringPolicy only determines if it is time to roll over when it receives events to log. If you require a rollover to occur every hour then you should use the CronTriggeringPolicy instead of the TimeBasedTriggeringPolicy.

> TimeBasedTriggeringPolicy not work if no log written in the next hour
> ---------------------------------------------------------------------
>
>                 Key: LOG4J2-2024
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-2024
>             Project: Log4j 2
>          Issue Type: Bug
>            Reporter: Shushan Tong
>
> I want to create a new file every hour, but it does not work if no log written in the next hour(s), log4j2.xml configured as below:
> <RollingFile name="RollingFile-for-bigdata" filename="${logPath}/bigdata/${logName}user_register.log" filepattern="${logPath}/bigdata/bak/b_%d{yyyyMMddHH}_user_register.dat">
>    <PatternLayout pattern="%msg%n" />
>    <Policies>
>     <TimeBasedTriggeringPolicy  interval="1"  modulate="true" />
>    </Policies>
>    <Filters>
>     ....
>    </Filters>
>    <DefaultRolloverStrategy max="24" />
>   </RollingFile>



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)