The TimedRotatingFileHandler class, located in the logging.handlers module, supports rotation of disk log files at certain timed intervals.
|filename [,when [,interval [,backupCount]]])
Returns a new instance of the TimedRotatingFileHandler class. The specified file is opened and used as the stream for logging. On rotating it also sets the filename suffix. Rotating happens based on the product of when and interval.
You can use the when to specify the type of interval. The list of possible values is, note that they are not case sensitive:
|Type of interval
|Week day (0=Monday)
|Roll over at midnight
If backupCount is non-zero, the system will save old log files by
appending extensions to the filename. The extensions are date-and-time
based, using the strftime format
%Y-%m-%d_%H-%M-%S or a leading
portion thereof, depending on the rollover interval. At most backupCount
files will be kept, and if more would be created when rollover occurs, the
oldest one is deleted.
See About this document... for information on suggesting changes.