Arulnambi Nandagoban wrote: > I am using logging module for my application to log all debug information. > I configured it create a new log file every day with > > "TimedRotatingFileHandler". I display debug message in console as well. > But I didn't see creation of new file.
Is the script running continuously? You won't see a rollover if you restart it. Working example (with shorter time interval): $ cat rollover.py import logging import logging.handlers import time logger = logging.getLogger() handler = logging.handlers.TimedRotatingFileHandler("logfile", when='S') logger.addHandler(handler) logger.setLevel(logging.INFO) for i in range(100): logger.info("message #%s" % i) time.sleep(.1) $ ls rollover.py $ python rollover.py $ ls logfile logfile.2014-08-04_15-21-26 logfile.2014-08-04_15-21-21 logfile.2014-08-04_15-21-27 logfile.2014-08-04_15-21-22 logfile.2014-08-04_15-21-28 logfile.2014-08-04_15-21-23 logfile.2014-08-04_15-21-29 logfile.2014-08-04_15-21-24 logfile.2014-08-04_15-21-30 logfile.2014-08-04_15-21-25 rollover.py $ cat logfile message #93 message #94 message #95 message #96 message #97 message #98 message #99 $ -- https://mail.python.org/mailman/listinfo/python-list