classification
Title: logging.Handler.close does something
Type: Stage:
Components: Documentation Versions: Python 3.0, Python 2.7, Python 2.6, Python 2.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: vinay.sajip Nosy List: LambertDW, georg.brandl, vinay.sajip
Priority: normal Keywords:

Created on 2008-08-30 12:13 by LambertDW, last changed 2008-09-01 17:46 by vinay.sajip. This issue is now closed.

Messages (2)
msg72191 - (view) Author: David W. Lambert (LambertDW) Date: 2008-08-30 12:13
Library documents claim that logging.Handler.close does nothing, but 
the source code shows otherwise---it removes itself from the internal 
handler list.  The error propagates treelike through the subclasses.  
(I found references to close in stream handler flush and 
NTEventLogHandler subclass).  I have source code for version 2.5, but 
the error likely persists through version 3.03b which 

http://docs.python.org/dev/3.0/library/logging.html#logging.StreamHandl
er

claims,

"flush()ΒΆ 
Flushes the stream by calling its flush() method. Note that the close
() method is inherited from Handler and so does nothing, so an 
explicit flush() call may be needed at times.
"

Actually, before reading the manual I tried

del streamHandler_on_my_stream; my_stream.close()

which didn't fix subsequent log messages that reported failure writing 
to closed stream.  __del__ might be easy to implement, and it seems 
natural.

Respectfully,
Dave
msg72282 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2008-09-01 17:46
Documentation fix checked in. The current behaviour is by design - but
the documentation was wrong and needed fixing.
History
Date User Action Args
2008-09-01 17:46:47vinay.sajipsetstatus: open -> closed
resolution: fixed
messages: + msg72282
2008-09-01 02:29:41benjamin.petersonsetassignee: georg.brandl -> vinay.sajip
nosy: + vinay.sajip
2008-08-30 12:13:13LambertDWcreate