<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Oct 24, 2012, at 10:22 AM, David M Chess <<a href="mailto:chess@us.ibm.com">chess@us.ibm.com</a>> wrote:</div><br><blockquote type="cite"><tt><font size="2">>> This works great, splitting the log information
across files by date, as <br>
>> long as the process is actually up at midnight.<br>
>><br>
>> But now the users have noticed that if the process isn't up at
midnight, <br>
>> they can end up with lines from two (or I guess potentially more)
dates in <br>
>> the same log file.<br>
>><br>
>> Is there some way to fix this, either with cleverer arguments
into the <br>
>> TimedRotatingFileHandler, or by some plausible subclassing of
it or its <br>
>> superclass?</font></tt>
<br>
<br><tt><font size="2">Tx,</font></tt>
<br><tt><font size="2">DC</font></tt>
<br></blockquote></div><div><br></div>(After a VERY brief scan of the logging cookbook and modules.)<br><div>I don't think you have any choice but brute force. If the program</div><div>wasn't up at midnight, then somehow it got restarted. You will have</div><div>to add logic to the restart code (or to the program itself that gets</div><div>run as it initializes).</div><div><br></div><div>Something like:</div><div><br></div><div>Does a log file exist? -> No -> First run; create log file & continue</div><div> |</div><div> Yes</div><div> |</div><div> Read backwards looking for date change, copy lines after change</div><div> to new file, delete from old file.</div><div><br></div><div>-Bill</div></body></html>