[New-bugs-announce] [issue39938] RotatingFileHandler does not support any other mode than 'a'.

Eric Govatos report at bugs.python.org
Wed Mar 11 14:54:14 EDT 2020


New submission from Eric Govatos <eric.lucas.govatos at rockwellcollins.com>:

The RotatingFileHandler class located within lib/logging/handlers.py  does not accept any other 'mode' value than its default value of 'a' - even when the parameter is supplied, such as 'ab', to append bytes, this is disregarded and the mode is set back to 'a' if the maxBytes variable is greater than 0. 

While the reasoning behind this does make sense as the rotating file handler should only be appending data to files, this means that supplying a mode to append bytes is not supported. You can currently get around this by supplying the mode after constructing the handler.

Proposed solution would be to remove lines 146 and 147 from the class entirely and let the user decide on the file mode themselves.

----------
components: Library (Lib)
messages: 363957
nosy: elgovatos
priority: normal
severity: normal
status: open
title: RotatingFileHandler does not support any other mode than 'a'.
type: behavior
versions: Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39938>
_______________________________________


More information about the New-bugs-announce mailing list