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 Shufla, r.david.murray, vinay.sajip
Date 2010-11-20.14:33:38
SpamBayes Score 3.1801267e-07
Marked as misclassified No
Message-id <1290263621.48.0.770965529656.issue10462@psf.upfronthosting.co.za>
In-reply-to
Content
The reason for this behaviour is as follows: the internal list of handlers now uses weak references, see

http://bugs.python.org/issue6615#msg95691

If there are no references to a handler, it can disappear at any time: and if it does, then it won't get closed at shutdown.

If there are references to it, then the shutdown code will close all handlers on application exit.

So: either leave references to your handlers, or close them when you're done with them, or add a __del__() which will call close() when the handler is garbage collected.

BTW removeHandler() does not call close(), and never has - these are two distinct operations.

It wouldn't be right for the logging package to automatically call close() on handlers, except at application exit - where the main reason for doing so is to flush any pending output and release any resources used by the handler.

Note that adding a __del__(self): self.close() method to MyHandler results in the close() being called [during garbage collection].
History
Date User Action Args
2010-11-20 14:33:41vinay.sajipsetrecipients: + vinay.sajip, r.david.murray, Shufla
2010-11-20 14:33:41vinay.sajipsetmessageid: <1290263621.48.0.770965529656.issue10462@psf.upfronthosting.co.za>
2010-11-20 14:33:38vinay.sajiplinkissue10462 messages
2010-11-20 14:33:38vinay.sajipcreate