RotatingFileHandler Error

R

Roopesh

Hi
I am trying to use RotatingFileHandler, in the foll way :

rootLogger = logging.getLogger('')
rootLogger.setLevel(logging.DEBUG)
rotatingHandler =
logging.handlers.RotatingFileHandler(self.logobj_path.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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top