Getting a TimedRotatingFileHandler not to put two dates in the same file?

David M Chess chess at us.ibm.com
Wed Oct 24 10:22:43 EDT 2012


> d at davea.name
>
> On 10/23/2012 11:23 AM, David M Chess wrote:
> > We have a TimedRotatingFileHandler with when='midnight'
>
> You give us no clue what's in this class, or how it comes up with the
> filenames used.

Sorry if I was unclear.  This isn't my own subclass of 
TimedRotatingFileHandler or anything, this is the bog-standard 
logging.handlers.TimedRotatingFileHandler I'm talking about.

So all clues about what's in the class, and how it comes up with the 
filenames used, is available at

http://docs.python.org/library/logging.handlers.html#timedrotatingfilehandler 


:)

The specific Python version involved here is Python 2.6.6 (r266:84297, Aug 
24 2010, 18:46:32), to the extent that that matters...

>> This works great, splitting the log information across files by date, 
as 
>> long as the process is actually up at midnight.
>>
>> But now the users have noticed that if the process isn't up at 
midnight, 
>> they can end up with lines from two (or I guess potentially more) dates 
in 
>> the same log file.
>>
>> Is there some way to fix this, either with cleverer arguments into the 
>> TimedRotatingFileHandler, or by some plausible subclassing of it or its 

>> superclass?

Tx,
DC

--
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20121024/a7525131/attachment.html>


More information about the Python-list mailing list