[Python-Dev] Some changes to logging for 3.2

Vinay Sajip vinay_sajip at yahoo.co.uk
Fri Sep 24 21:32:41 CEST 2010

Chris Withers <chris <at> simplistix.co.uk> writes:

> Cool, how can I use it in Python 2.6? 
> Chris

Hi Chris,

1. Copy the top part (imports, QueueHandler and QueueListener classes) from the
Gist linked to in the article - http://gist.github.com/591699 - into a utility
module you can use again and again.

2. In your code, try to import them from logging.handlers and in an except
ImportError: clause, import them from your utility module.

3. Profit ;-)

Note that there's a slight change in the Gist from when the post was published -
but it should still work as per the post. Until 3.2 is out, there may be other
small changes: but you can copy the code over from the 3.2 branch in the Python
SVN repository later and it should work fine under Python 2.6 and 2.7.

Of course if you do find any problems (or have any other questions), please let
me know asap :-)


Vinay Sajip

More information about the Python-Dev mailing list