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

Ralph Goers edited comment on LOG4J2-1250 at 7/2/16 8:55 PM:
-------------------------------------------------------------

Actually, it is a bit more complicated than that.  Note that the expression in 
the CronTriggeringPolicy might not match the date expression in the 
filePattern. The getNextTime method is really calculating when the next 
rollover should take place and is using the previous rollover time as the value 
to use to format the filePattern. Likewise, the CronTriggeringPolicy needs to 
update the PatternProcessor with either the time the file was last written to 
or the time of the last rollover before initiating a new rollover. We really 
don't want to call getNextTime to do that.

I suspect the SizeBasedTriggeringPolicy has a similar problem.


was (Author: [email protected]):
Yes, this sounds reasonable.

> [2.5] CronTriggeringPolicy renaming behavior when midnight.
> -----------------------------------------------------------
>
>                 Key: LOG4J2-1250
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1250
>             Project: Log4j 2
>          Issue Type: Question
>          Components: Appenders
>    Affects Versions: 2.5
>            Reporter: lee yongjoong
>            Assignee: Ralph Goers
>
> Hi.
> I tried CrontriggeringPolicy(added 2.5) for save daily log files at midnight.
> My goal is, for example.
> if today is 2015/01/01, "http.log" <- active file.
> and when midnight, "http.log" will be renamed "http_20150101.log", and create 
> new "http.log".
> But my problem is when midnight, "http.log" renamed "http_20150102.log"...
> I want to make that file's name "http_20150101.log" because that file has 
> 2015/01/01's log,
> Here's my configure xml.
> {code:xml}
> <Routing name="routing_file">
>   <Routes pattern="pattern1">
>     <Route key="http">
>       <RollingFile name="rolling_http" filename="${path}/http.log" 
> filepattern="${path}/http_%d{yyyyMMdd}.log">
>         <PatternLayout pattern="http"/>
>         <CronTriggeringPolicy schedule="0 0 0 * * ?"/>
>       </RollingFile>
>     </Route>
>   </Routes>
> </Routing>
> {code}
> Please help me.
> Thanks for your help, I'm very appreciated it :D



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to