question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

rotation to mutli file when logging in mutli-process

See original GitHub issue

test 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:closed
  • Created 4 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
bcwkcommented, Mar 22, 2020

Yes, i have no more questions, please close this issue . And thanks again for your suggestion, you are so kind and patiently.

0reactions
Delgancommented, Mar 21, 2020

I hope you can find implement a solution that suits your needs. Can I close this issue or do you have any other questions?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found