This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vinay.sajip
Recipients ericg97477, vinay.sajip
Date 2015-07-27.12:22:41
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1437999762.36.0.325073011076.issue24717@psf.upfronthosting.co.za>
In-reply-to
Content
Context is crucial. The Python documentation is not wrong, but doesn't belabour the point that it refers to the most common, single-process case. The problem you encountered is not specific to logging: you need to understand all aspects of how forking works and how Python works within the framework of POSIX and forking. It's a non-trivial topic and too much to go into here - suffice to say that in order to get the result you expect, you need (as I said in an earlier comment) to configure logging in code that is called in each process of a multiple-process setup. If you add two handlers to a logger, one before forking and one after forking, then the child process might behave as expected, but logging from the parent process could output multiple copies of the same message. If you don't do any logging in the parent, that might be OK, but it still doesn't feel like the right approach.

You might find it helpful to read my 2010 blog post about logging and multiprocessing:

http://plumberjack.blogspot.co.uk/2010/09/using-logging-with-multiprocessing.html

AFAIK nothing fundamental has changed since then to invalidate the overall thrust of that post.
History
Date User Action Args
2015-07-27 12:22:42vinay.sajipsetrecipients: + vinay.sajip, ericg97477
2015-07-27 12:22:42vinay.sajipsetmessageid: <1437999762.36.0.325073011076.issue24717@psf.upfronthosting.co.za>
2015-07-27 12:22:42vinay.sajiplinkissue24717 messages
2015-07-27 12:22:41vinay.sajipcreate