[ python-Bugs-842170 ] logging.shutdown() exception

SourceForge.net noreply at sourceforge.net
Fri Nov 14 10:38:54 EST 2003


Bugs item #842170, was opened at 2003-11-14 15:38
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=842170&group_id=5470

Category: Extension Modules
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: j vickroy (jvickroy)
Assigned to: Nobody/Anonymous (nobody)
Summary: logging.shutdown() exception

Initial Comment:
Python version:
Python 2.3 (#46, Jul 29 2003, 18:54:32) [MSC v.1200 
32 bit (Intel)] on win32

Operating System:
MS Windows 2000 Professional with all latest patches

Synopsis:

When reassigning a handler (RotatingFileSystem) to a 
logger during execution, close() must be invoked against 
the current handler.  Failure to do so causes the 
following exception to be raised:

 Traceback (most recent call last):
   File
 "C:\Python23\lib\site-
packages\Pythonwin\pywin\framework\scriptutils.py",
 line 310, in RunScript
     exec codeObject in __main__.__dict__
   File "E:\\experimental\Py Logging\t_xc.py", 
line 61, in ?
     log.error('testing Python logging module')
   File "C:\Python23\lib\logging\__init__.py", line 923, in 
error
     apply(self._log, (ERROR, msg, args), kwargs)
   File "C:\Python23\lib\logging\__init__.py", line 994, in 
_log
     self.handle(record)
   File "C:\Python23\lib\logging\__init__.py", line 1004, in 
handle
     self.callHandlers(record)
   File "C:\Python23\lib\logging\__init__.py", line 1037, in 
callHandlers
     hdlr.handle(record)
   File "C:\Python23\lib\logging\__init__.py", line 592, in 
handle
     self.emit(record)
   File "C:\Python23\lib\logging\handlers.py", line 105, in 
emit
     self.doRollover()
   File "C:\Python23\lib\logging\handlers.py", line 90, in 
doRollover
     os.rename(self.baseFilename, dfn)
 OSError: [Errno 13] Permission denied

If close() is applied to each handler, except the final 
assigned handler, then logging.shutdown() raises the 
following exception when it is applied prior to application 
termination:

Traceback (most recent call last):
  File "D:\\experimental\Py Logging\t_xb.py", 
line 63, in ?
    shutdown()
  File "C:\Python23\lib\logging\__init__.py", line 1195, in 
shutdown
    h.flush()
  File "C:\Python23\lib\logging\__init__.py", line 661, in 
flush
    self.stream.flush()
ValueError: I/O operation on closed file

apparently, because it is attempting to close previously-
closed handlers.

Please, see attachment for a relevant script.

If it is agreed that this is an appropriate use of the 
logging system (and I think it is <smile>), I would be 
willing to attempt a patch if that is preferable.

Thanks for your time.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=842170&group_id=5470



More information about the Python-bugs-list mailing list