[New-bugs-announce] [issue16244] TimedRotatingFileHandler forces "write" mode, should use "append"

Richard Jones report at bugs.python.org
Tue Oct 16 07:05:37 CEST 2012


New submission from Richard Jones:

The RotatingFileHandler classes force the open() mode of the new log file to be "w" even though it is initially defaulted to "a" in doRollover() methods:

        self.mode = 'w'
        self.stream = self._open()

This can cause problems in systems that have multiple programs writing to the log file; they can both end up opening the new file in "w" mode and then there's loss of data.

I cannot think of a reason why "w" should be forced in this manner.

The fix is to remove the "self.mode = 'w'" line from the two doRollover() methods.

----------
components: Library (Lib)
messages: 173016
nosy: richard
priority: normal
severity: normal
status: open
title: TimedRotatingFileHandler forces "write" mode, should use "append"
type: behavior

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16244>
_______________________________________


More information about the New-bugs-announce mailing list