Multiprocessing & Logging

Vinay Sajip vinay_sajip at yahoo.co.uk
Sat Apr 7 20:56:20 EDT 2012


Thibaut <merwin.irc <at> gmail.com> writes:

> This is exactly what I wanted, it seems perfect. However I still have a 
> question, from what I understood,
> I have to configure logging AFTER creating the process, to avoid 
> children process to inherits the logging config.
> 
> Unless there is a way to "clean" logging configuration in children 
> processes, so they only have one handler : the QueueHandler.
> 
> I looked at the logging code and it doesn't seems to have an easy way to 
> do this. The problem of configuring the logging
> after the process creation is that... I can't log during process 
> creation. But if it's too complicated, I will just do this.
> 

I've updated the 3.2 / 3.3 logging cookbook with an example of what I mean.
There is a gist of the example script at

https://gist.github.com/2331314/

and the cookbook example should show once the docs get built on docs.python.org.

Regards,

Vinay Sajip





More information about the Python-list mailing list