pfalcon / pycopy-lib

Standard library of the Pycopy project, minimalist and light-weight Python language implementation
https://github.com/pfalcon/pycopy
Other
246 stars 70 forks source link

[logging.RotatingFileHandler] The rotation logic doesn't take into account initial log file size. #87

Closed PolarGoose closed 2 months ago

PolarGoose commented 2 months ago

Bug description RotatingFileHandler 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

PolarGoose commented 2 months ago

My bad, I didn't notice the line #32