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.
This fix breaks the behavior of RotatingFileHandler. Maxbytes>0 can now be only used with backupCount>0 otherwise it is ignored. So all programs that are using Maxbytes>0 and backupCount=0 are now facing an infinitely growing logfile.