creating log file with Python logging module

Peter Otten __peter__ at web.de
Mon Aug 4 10:03:29 EDT 2014


Peter Otten wrote:

> Peter Otten wrote:
> 
>> You won't see a rollover if you restart it.
> 
> Sorry, I tried it and the above statement is wrong.

[Arulnambi Nandagoban]

> logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s -
> %(message)s', datefmt='%a, %d %b %Y %H:%M:%S', level = logging.DEBUG,
> filename=Ffilename, filemode='w')
> 
> logger = logging.getLogger(__name__)
> 
> hdlr = TimedRotatingFileHandler(Ffilename, when='midnight')

My alternative theory about what might be going wrong: you are using the 
same file in logging.basicConfig() and the TimedRotatingFileHandler.

But I cannot replicate the problem on my (linux) system.




More information about the Python-list mailing list