问题描述
我目前正在尝试从多个进程登录到单个文件,但是我遇到了很多麻烦.我花了无数个小时在网上寻找东西-stackoverflow和Google,但没有提出任何具体建议.
I am currently trying to log to a single file from multiple processes but I am having a lot of trouble with it. I have spend countless hours looking online -- stackoverflow and Google, but have come up with nothing concrete.
我一直在尝试使用zzzeek的代码,但它不会为我写入文件.我没有特定的执行方式-我一直在尝试所有可能的方式.
I've been trying to use zzzeek's code but it does not write to the file for me. I don't have a specific way I'm doing it -- I've just been trying every way I can.
任何人都可以使用它,并具有示例代码,或者您有其他替代方法.我需要将多个进程记录到同一个文件中.我还想将任何错误从各种类记录到同一文件.但是,我对简单地使多进程工作起来感到满意.
Have any of you got it to work and have sample code, or do you have an alternative way of doing it. I need to log multiple processes to the same file. I would also like to log any errors from various class to the same file. I, however, am satisfied with simple getting the multiprocess one to work.
谢谢
推荐答案
看看这些帖子:
- Using logging with multiprocessing
- Improved QueueHandler, QueueListener: dealing with handlers that block
- logutils: Using recent logging features with older Python versions
这篇关于Python MultiProcess,日志记录,各种类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!