Message121655
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]. |
|
Date |
User |
Action |
Args |
2010-11-20 14:33:41 | vinay.sajip | set | recipients:
+ vinay.sajip, r.david.murray, Shufla |
2010-11-20 14:33:41 | vinay.sajip | set | messageid: <1290263621.48.0.770965529656.issue10462@psf.upfronthosting.co.za> |
2010-11-20 14:33:38 | vinay.sajip | link | issue10462 messages |
2010-11-20 14:33:38 | vinay.sajip | create | |
|