rotation to mutli file when logging in mutli-process
See original GitHub issuetest code such as :
fix_rotation = "18:30"
def LoguruTest(token=None):
logger.add('loguru_test_{time:YYYY:MM:DD_HH:mm}.log', rotation=fix_rotation, enqueue=True)
test_count = 0
while test_count<30:
time.sleep(2.0+random.uniform(0.3,2.6))
logger.debug('11111111')
test_count+=1
if __name__ == "__main__":
p = Pool(5)
for i in range(5):
p.apply_async(LoguruTest, args=(f't_{i}',))
p.close()
p.join()
before 18:30, all 5 processes wirte to one file; but after 18:30 they write to 5 files.
Python 3.7.0 loguru 0.4.1 CentOS Linux release 7.2.1511
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
multiple processors logging to same rotate file - Stack Overflow
Just for the heck of it, here is a complete solution example which uses python StreamHandler, uWSGI "daemonized file logging", and logrotate ...
Read more >(Semi-)correct handling of log rotation in multiprocess Python ...
This handler rotates the log file once its size exceeds a predefined threshold by renaming each backup to increase its backup number (e.g....
Read more >RotatingFileHandler with multi processes creates too small ...
Using RotatingFileHandler by multi-processes when they reach a point for rotation (roll-over) they continue on separate files.
Read more >48704 – Multiple Java Process in Cluster Logging to the same ...
When multiple java process log to the same log file and rotate the same log file the process that gets to rotate the...
Read more >Handlers - picologging documentation - Microsoft Open Source
Base class for handlers that rotate log files at a certain point. ... Queue to centralise logging to file in one process (in...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, i have no more questions, please close this issue . And thanks again for your suggestion, you are so kind and patiently.
I hope you can find implement a solution that suits your needs. Can I close this issue or do you have any other questions?