Logging

Neil Benn benn at cenix-bioscience.com
Wed Feb 2 07:01:57 EST 2005


Neil Benn wrote:

> Hello,
>
>          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 :
>
> .<snip>

Previous code missed out a line :

.>>> import logging
.>>> objTestLogger = logging.getLogger()
.>>> objTestLogger.setLevel(logging.INFO)
.>>> objTestLogger.addHandler(logging.FileHandler('c:\\test.log'))
.>>> objTestLogger.info("THIS IS A TEST")
.>>> logging.shutdown()
.>>> objTestLogger = logging.getLogger()
.>>> objTestLogger.setLevel(logging.INFO)
.>>> objTestLogger.addHandler(logging.FileHandler('c:\\test.log'))
.>>> objTestLogger.info("THIS IS A TEST")
.Traceback (most recent call last):
. File "c:\program files\python23\lib\logging\__init__.py", line 679, in 
emit
.    self.stream.write("%s\n" % msg)
.ValueError: I/O operation on closed file
.>>>

    Sorry for the orginal mispost!!

Cheers,

Neil


-- 

Neil Benn
Senior Automation Engineer
Cenix BioScience
BioInnovations Zentrum
Tatzberg 46
D-01307
Dresden
Germany

Tel : +49 (0)351 4173 154
e-mail : benn at cenix-bioscience.com
Cenix Website : http://www.cenix-bioscience.com




More information about the Python-list mailing list