I use TimedRotatingFileHandler to logging Django log and rotate every day, but check the log file, strange issue is yesterday log is truncated and logging few today\'s log,
You should not be logging to a file-based handler from multiple processes concurrently - that is not supported, as there is no portable OS support for it.
To log to a single destination from multiple processes, you can use one of the following approaches:
SysLogHandler
(or NTEventLogHandler
on Windows)SocketHandler
which sends the logs to a separate process for writing to fileQueueHandler
with a multiprocessing.Queue
, as outlined here.