django TimedRotatingFileHandler log

15.9.6. TimedRotatingFileHandler

The TimedRotatingFileHandler class, located in the logging.handlers module, supports rotation of disk log files at certain timed intervals.

class logging.handlers.TimedRotatingFileHandler(filenamewhen='h'interval=1backupCount=0encoding=Nonedelay=Falseutc=False)

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 below. Note that they are not case sensitive.

  
ValueType of interval
'S' Seconds
'M' Minutes
'H' Hours
'D' Days
'W0'-'W6' Weekday (0=Monday)
'midnight' Roll over at midnight

posted on 2018-07-27 16:33  ExplorerMan  阅读(827)  评论(0编辑  收藏  举报

导航