Need help in configuration for TimedRotatingFileHandler

Lokesh Maremalla lokeshmaremalla at gmail.com
Mon Aug 10 01:21:09 EDT 2009


Hi Dave,

I forgot to provide the information about the code how I am using logger
Here is the complete scenario

I have modified the code as mentioned in reply and is working fine. But
still I am facing an issue and the issue is described below.

In configuration file i have coded the TimedRotatingFileHandler like
args=("G:\\lok_sib\\logs\\rotate_test", 'D', 1)

Code:
mlogger = logging.getLogger("simpleExample")
def a_view(request):
    mlogger.debug("a_view called")
    if request.method== "POST" :
        mlogger.debug("post function")
    else:
        mlogger.debug("serve function")

Execution:
step1: Executed the code and got the log file with the information
step2: Modified the system time from current day to next day
step3: End up with the error and the error is pasted below

Traceback (most recent call last):
  File "c:\Python25\lib\logging\handlers.py", line 74, in emit
    self.doRollover()
  File "c:\Python25\lib\logging\handlers.py", line 274, in doRollover
    os.rename(self.baseFilename, dfn)
WindowsError: [Error 32] The process cannot access the file because it is
being used by another process

Python version - 2.5.4

I guess my output should be like this for the next day
-a new log file rotate_test.<date format> should generate in the respective
location

Please correct me if I am wrong.


Thanks for your time.

Regards,
Lokesh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090810/08525287/attachment-0001.html>


More information about the Python-list mailing list