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

Lars Liedtke lal at solute.de
Wed Jun 22 06:06:57 EDT 2022


-- 
Lars Liedtke
Software Entwickler

			
Phone: 	
Fax: 	+49 721 98993-
E-mail:	lal at solute.de


solute GmbH
Zeppelinstraße 15				
76185 Karlsruhe
Germany


Marken der solute GmbH | brands of solute GmbH
billiger.de | Shopping.de 


Geschäftsführer | Managing Director: Dr. Thilo Gans, Bernd Vermaaten
Webseite | www.solute.de
Sitz | Registered Office: Karlsruhe
Registergericht | Register Court: Amtsgericht Mannheim
Registernummer | Register No.: HRB 110579
USt-ID | VAT ID: DE234663798


Informationen zum Datenschutz | Information about privacy policy
http://solute.de/ger/datenschutz/grundsaetze-der-datenverarbeitung.php

Am 21.06.22 um 11:04 schrieb Chethan Kumar S:
> I have a main process which makes use of different other modules. And these modules also use other modules. I need to log all the logs into single log file. Due to use of TimedRotatingFileHandler, my log behaves differently after midnight. I got to know why it is so but couldn't get how I can solve it.
> Issue was because of serialization in logging when multiple processes are involved.

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.

I don't know, if that helps with your multiple processes, or is a 
solution at all.

Cheers

Lars




More information about the Python-list mailing list