Python Logging question

tpatch at loftware.com tpatch at loftware.com
Fri Apr 18 14:55:27 EDT 2008


I am new to Python and I am trying to understand how to utilize the RotatingFileHandler to rollover
when the file gets to a certain size.  I followed some examples that I have found for setting the size and
the number of files.  However, I am finding that when the log file gets close to the threshold I start getting
errors in the "handlers.py" file saying the file is closed.

I am using Python 2.5 on Windows.

Is this a problem others have seen?
Is this a handler that is widely used or is there a better one that is generally used?

The error that I am receiving is shown below.

Traceback (most recent call last):
  File "C:\Python25\Lib\logging\handlers.py", line 73, in emit
    if self.shouldRollover(record):
  File "C:\Python25\Lib\logging\handlers.py", line 147, in shouldRollover
    self.stream.seek(0, 2)  #due to non-posix-compliant Windows feature
ValueError: I/O operation on closed file


My configuration file is setup as such:

[handler_file_detailed]
class:handlers.RotatingFileHandler
level:DEBUG
formatter:detailed
mode=a
maxsize=4000000
backcount=5
args:('python.log','a',4000000,5)

I would appreciate any feedback on this subject.

Thanks,

Todd

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080418/0bf8a016/attachment.html>


More information about the Python-list mailing list