Logging into single file from multiple modules in python when TimedRotatingFileHandler is used

Barry Scott barry at barrys-emacs.org
Wed Jun 22 07:06:24 EDT 2022



> On 22 Jun 2022, at 11:06, Lars Liedtke <lal at solute.de> wrote:
> 
> Could be unrelated and only a part of a solution, but if you are on a unixoid system, you could use logrotate, instead of TimedRotatingFileHandler. logfrotate ensures that the logging service does not realize, its logs have been rotated. So it can log as if nothing has happened.


The process that is writing the file must be told that rotation has happened for it to work.
Other wise all the logs keep being write to the original file via the FD that the process has.

logrotate's config include how to tell the process the log file needs reopening.

Barry




More information about the Python-list mailing list