Logging

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Neil Benn

    #1

    Logging

    Hello,

    I'm running a test and having issues with logging, if I call
    logging.shutdow n() 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.getLogg er()
    ..>>> objTestLogger.s etLevel(logging .INFO)
    ..>>> objTestLogger.a ddHandler(loggi ng.FileHandler( 'c:\\test.log') )
    ..>>> objTestLogger.i nfo("THIS IS A TEST")
    ..>>> logging.shutdow n()
    ..>>> objTestLogger = logging.getLogg er()
    ..>>> objTestLogger.s etLevel(logging .INFO)
    ..>>> objTestLogger.i nfo("THIS IS A TEST")
    ..Traceback (most recent call last):
    .. File "<stdin>", line 1, in ?
    .. File "c:\program files\python23\ lib\logging\__i nit__.py", line 893,
    in info
    .. apply(self._log , (INFO, msg, args), kwargs)
    .. File "c:\program files\python23\ lib\logging\__i nit__.py", line 994,
    in _log
    .. self.handle(rec ord)
    .. File "c:\program files\python23\ lib\logging\__i nit__.py", line 1004,
    in handle
    .. self.callHandle rs(record)
    .. File "c:\program files\python23\ lib\logging\__i nit__.py", line 1037,
    in callHandlers
    .. hdlr.handle(rec ord)
    .. File "c:\program files\python23\ lib\logging\__i nit__.py", line 592,
    in handle
    .. self.emit(recor d)
    .. File "c:\program files\python23\ lib\logging\han dlers.py", line 103,
    in emit
    .. self.stream.see k(0, 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.shutdow n the logging is buggered for that process - is my
    analysis correct?

    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@cenix-bioscience.com
    Cenix Website : http://www.cenix-bioscience.com

Working...