The RotatingFileHandler class supports rotation of disk log files.
|filename[, mode[, maxBytes[, backupCount]]])|
'a'is used. By default, the file grows indefinitely. You can use the maxBytes and backupCount values to allow the file to rollover at a predetermined size. When the size is about to be exceeded, the file is closed and a new file opened for output, transparently to the caller. Rollover occurs whenever the current log file is nearly maxBytes in length. If backupCount is >= 1, the system will successively create new files with the same pathname as the base file, but with extensions ".1", ".2" etc. appended to it. For example, with a backupCount of 5 and a base file name of "app.log", you would get "app.log", "app.log.1", "app.log.2", ... through to "app.log.5". When the last file reaches its size limit, the logging reverts to "app.log" which is truncated to zero length. If maxBytes is zero, rollover never occurs.
See About this document... for information on suggesting changes.