Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Logging

Thread Tools


Neil Benn
Posts: n/a

I'm running a test and having issues with logging, if I call
logging.shutdown() and then want to start the logging going again then I
get a problem as if I call shutdown, I can't get the root logger again,
such as :

..>>> import logging
..>>> objTestLogger = logging.getLogger()
..>>> objTestLogger.setLevel(logging.INFO)
..>>> objTestLogger.addHandler(logging.FileHandler('c:\\ test.log'))
..>>>"THIS IS A TEST")
..>>> logging.shutdown()
..>>> objTestLogger = logging.getLogger()
..>>> objTestLogger.setLevel(logging.INFO)
..>>>"THIS IS A TEST")
..Traceback (most recent call last):
.. File "<stdin>", line 1, in ?
.. File "c:\program files\python23\lib\logging\", line 893,
in info
.. apply(self._log, (INFO, msg, args), kwargs)
.. File "c:\program files\python23\lib\logging\", line 994,
in _log
.. self.handle(record)
.. File "c:\program files\python23\lib\logging\", line 1004,
in handle
.. self.callHandlers(record)
.. File "c:\program files\python23\lib\logging\", line 1037,
in callHandlers
.. hdlr.handle(record)
.. File "c:\program files\python23\lib\logging\", line 592,
in handle
.. self.emit(record)
.. File "c:\program files\python23\lib\logging\", line 103,
in emit
.., 2) #due to non-posix-compliant Windows feature
..ValueError: I/O operation on closed file

This means that I any code that write or use, if it calls
logging.shutdown the logging is buggered for that process - is my
analysis correct?




Neil Benn
Senior Automation Engineer
Cenix BioScience
BioInnovations Zentrum
Tatzberg 46

Tel : +49 (0)351 4173 154
e-mail : Removed)
Cenix Website :

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Logging to a file and closing it again properly (logging module) Christoph Haas Python 1 06-14-2006 08:47 AM
Logging to a file and closing it again properly (logging module) Christoph Haas Python 0 06-12-2006 09:58 PM
logging buffered vs. logging history Christian Roos Cisco 4 02-05-2006 10:55 PM
java.util.logging, where to put janne Java 0 09-10-2004 10:18 AM
[java.util.logging] logging only to _one_ file Stefan Siegl Java 0 08-27-2003 12:29 PM