TimedRotatingFileHandler() isn't rotating at midnight?

Chris Shenton chris-list-python at shenton.org
Thu Feb 1 00:32:39 EST 2007


I set this up 3 days ago and have not seen any of the logs I've
created this way being rotated.  I expected them to rotate every
midnight.  I'm calling the code that uses this logger many times, each
a separate run, if that matters.

Am I doing something stupid? I can't find anything on google and don't
see anything in the code that would prevent rotating. 

Thanks.

import logging, logging.handlers
logging.getLogger().setLevel(logging.DEBUG) # override default of WARNING

logfile = logging.handlers.TimedRotatingFileHandler(filename, 'midnight', 1, backupCount=14)
logfile.setLevel(logging.DEBUG)
logfile.setFormatter(logging.Formatter('%(asctime)s %(levelname)-8s %(module)s: %(message)s'))
logging.getLogger().addHandler(logfile)



More information about the Python-list mailing list