Harry <harry.l...@gmail.com> added the comment:

This bug seems to come from the fact that the file rollover occurs it removes 
any files with same name as the destination file.

I believe this bug occurs on all "when" options, but the midnight option 
truncates the filename so only the date so it's much more likely to be a 
collision in filename so it's much easier to notice that it's happening.

One way of fixing this is to check if the destination file already exists, and 
if it does, append the logs to the end of the file instead of overwriting it.

Another potential fix is to check if the destination file already exists, and 
if it does rename it to something else, or even to choose a different name for 
the destination file of the log e.g. if the filename would be log.2021-05-05 
but there is a collision, call the file log.2021-05-05(1).

Personally I prefer the last option, it seems like the best way to avoid any 
future issues that could arise from appending. I can open a PR for this in the 
morning.

----------
nosy: +Harry-Lees

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue44186>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to