Closed vikramsubramanian closed 2 weeks ago
You just need use logger.add()
once.
Right! It works if I just run a single python script, however, what if I need to run multi python scripts and output their logs into the same log file with no repeating, is it possible?
If your script is composed of multiple files, calling logger.add()
only once will suffice.
If you're running multiple script in parallel in different processes, then writing to the same file isn't safe because they won't have a way to synchronize file access, resulting in muddled logs.
Please share an example demonstrating your problem if you need further help.
Thanks a lot! I will use different log files next to avoid synchronize problems. Thanks again.
You're welcome. :+1:
I'm closing this ticket consequently. ;)
I want to use a single log file to record all logs in my project. So I simply add the following lines in each python file:
However, when I read the
logfile.log
, I found that info"test_info"
repeat many times in the log file. So how can I avoid this repeatment? Thanks!