logging problem

Shine Anne m2ids2005 at gmail.com
Wed Apr 26 05:36:03 EDT 2006


HI All,
 I am having an app that needs to display a lot of msgs.
These msgs need to kept ina log.
I have written it as :
D
EBUG =1

if DEBUG:

    import logging
    logging.basicConfig(level=logging.DEBUG,
                    format='%(asctime)s %(levelname)s %(message)s',
                    filename='x.log',
                    filemode='w')
def DBG (s):
    if DEBUG:
        logging.debug(s)

Then whereever i need i tried calling
DBG("xxxxx")
but i am getting error as:

Traceback (most recent call last):
  File "C:\Python24\lib\logging\__init__.py", line 712, in emit
    self.stream.write(fs % msg)
ValueError: I/O operation on closed file

Can anyone help me..i am new to python so plz help
--
Regards,

Shine Anne
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20060426/6fc69f01/attachment.html>


More information about the Python-list mailing list