By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,172 Members | 762 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,172 IT Pros & Developers. It's quick & easy.

RotatingFileHandler Error

P: n/a
Hi
I am trying to use RotatingFileHandler, in the foll way :

rootLogger = logging.getLogger('')
rootLogger.setLevel(logging.DEBUG)
rotatingHandler =
logging.handlers.RotatingFileHandler(self.logobj_p ath.name,"a", 1000,
10)
rotatingHandler.doRollover()
rotatingHandler.emit()
rootLogger.addHandler(rotatingHandler)
logging.info('info')
self.logger = logging.getLogger('myapp.area1')

It results in the foll error :

lne 86, in __init__
rotatingHandler.doRollover()
File "c:\python24\lib\logging\handlers.py", line 131, in doRollover
os.rename(self.baseFilename, dfn)
OSError: [Errno 13] Permission denied
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "c:\python24\lib\atexit.py", line 24, in _run_exitfuncs
func(*targs, **kargs)
File "c:\python24\lib\logging\__init__.py", line 1351, in shutdown
h.flush()
File "c:\python24\lib\logging\__init__.py", line 731, in flush
self.stream.flush()
ValueError: I/O operation on closed file
Error in sys.exitfunc:
Traceback (most recent call last):
File "c:\python24\lib\atexit.py", line 24, in _run_exitfuncs
func(*targs, **kargs)
File "c:\python24\lib\logging\__init__.py", line 1351, in shutdown
h.flush()
File "c:\python24\lib\logging\__init__.py", line 731, in flush
self.stream.flush()
ValueError: I/O operation on closed file

Can anyone tell me, w hat is wrong with my code.

Roopesh

Dec 29 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.