Vinay Sajip <vinay_sa...@yahoo.co.uk> added the comment:

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].

----------
resolution:  -> invalid
status: open -> closed

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue10462>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to