Bug descriptionRotatingFileHandler opens the log file in the append ("a") mode.
The handler uses self._counter to detect when the log rotation needs to be done.
However, the self._counter is never initialized with the initial size of the log file.
It can lead to a situation when the log file will be twice what the maxBytes parameter specifies.
Proposal
Open the log file in the constructor and initialize the self._counter variable with the size of the log file.
Bug description RotatingFileHandler opens the log file in the append (
"a"
) mode. The handler usesself._counter
to detect when the log rotation needs to be done. However, theself._counter
is never initialized with the initial size of the log file. It can lead to a situation when the log file will be twice what themaxBytes
parameter specifies.Proposal
self._counter
variable with the size of the log file.