classification
Title: code or doc improvement for logging.handlers.RotatingFileHandler
Type: enhancement Stage: resolved
Components: Documentation Versions: Python 3.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: docs@python, python-dev, redstone-cold, vinay.sajip
Priority: normal Keywords:

Created on 2016-12-29 16:29 by redstone-cold, last changed 2016-12-31 11:07 by python-dev. This issue is now closed.

Messages (2)
msg284277 - (view) Author: iMath (redstone-cold) Date: 2016-12-29 16:29
For 
class logging.handlers.RotatingFileHandler(filename, mode='a', maxBytes=0, backupCount=0, encoding=None, delay=0) 

if backupCount is zero and maxBytes is non-zero, the log file size could exceed maxBytes, i.e. we are not able to restrict the log file size using RotatingFileHandler at this case .
I suggest add the above description to the doc 
https://docs.python.org/3.6/library/logging.handlers.html#logging.handlers.RotatingFileHandler
If possible , set backupCount=1 by default to avoid this pitfall as much as possible.

The doc right now just says "if either of maxBytes or backupCount is zero, rollover never occurs.", it is too difficult to understand the meaning of 'Rollover' to aviod the pitfall .
msg284382 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-12-31 11:07
New changeset 4255c7aae85b by Vinay Sajip in branch '3.6':
Closes #29105: Updated RotatingFileHandler documentation.
https://hg.python.org/cpython/rev/4255c7aae85b
History
Date User Action Args
2016-12-31 11:07:48python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg284382

resolution: fixed
stage: resolved
2016-12-31 01:16:35berker.peksagsetnosy: + vinay.sajip
2016-12-29 16:29:54redstone-coldcreate