logging module ValueError: I/O operation on closed file

emvee bhian emvee.bh at gmail.com
Mon Jun 19 18:49:42 EDT 2006


getting the following error  while using logging at random
any idea what can cause this behaviour

Traceback (most recent call last):
File    lib/python2.4/logging/__init__.py", line 737, in emit
ValueError: I/O operation on closed file


        self.Log = logging.getLogger('MAIN')
        sFormat='%(asctime)s %(name)s %(levelname)s %(message)s'
        filer = logging.FileHandler('/tmp/log.log','a')
        filer.setLevel(logging.DEBUG)
        formatter = logging.Formatter(sFormat)
        filer.setFormatter(formatter)

        Erfiler = logging.FileHandler('/tmp/error.log','a')
        Erfiler.setLevel(logging.ERROR)
        Erfiler.setFormatter(formatter)
        #logging.getLogger('').addHandler(filer)
        self.Log.addHandler(filer)
        self.Log.addHandler(Erfiler)


using the following in subsequent modules
self.Log = logging.getLogger('MAIN.MODULE')
 self.Log.info("log the message")
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20060619/c4075e2d/attachment.html>


More information about the Python-list mailing list