S
s99999999s2003
hi
i have defined a function
def logger(logfile,msg):
import logging
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s %(levelname)-8s
%(message)s',
datefmt='%a, %d %b %Y %H:%M:%S',
filename='%s' % (logfile),
filemode='a')
logging.critical(msg)
logging.error(msg)
logging.warning(msg)
logging.info(msg)
logging.shutdown()
In my main code:
----- some python code here---
logger("test.log","error")
......
......
logger("test.log","another error")
....
logger("test.log","yet another error")
....
sys.exit(0)
When i do the above, i get :
self.stream.write(fs % msg)
ValueError: I/O operation on closed file
If i removed logging.shutdown(), it workds..what is wrong with my
function ?
thanks
i have defined a function
def logger(logfile,msg):
import logging
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s %(levelname)-8s
%(message)s',
datefmt='%a, %d %b %Y %H:%M:%S',
filename='%s' % (logfile),
filemode='a')
logging.critical(msg)
logging.error(msg)
logging.warning(msg)
logging.info(msg)
logging.shutdown()
In my main code:
----- some python code here---
logger("test.log","error")
......
......
logger("test.log","another error")
....
logger("test.log","yet another error")
....
sys.exit(0)
When i do the above, i get :
self.stream.write(fs % msg)
ValueError: I/O operation on closed file
If i removed logging.shutdown(), it workds..what is wrong with my
function ?
thanks