Per thread logging in python

前端 未结 5 1705
逝去的感伤
逝去的感伤 2021-01-13 05:03

Consider a multi threaded python application using python logger module. I want to do per thread logging, so I have appended the a unique-ID (not thread id) at the bottom of

5条回答
  •  日久生厌
    2021-01-13 05:21

    I wouldn't recommend a solution which has separate files for separate threads: you can always separate out the information from a common log file if you add thread / threadName to the format string. You can do what you're asking for, using a Filter subclass, as described in this post for a similar (but not identical) use case.

提交回复
热议问题