This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: Log rotate cant execute in Windows. (logging module)
Type: Stage:
Components: Library (Lib) Versions: Python 2.7
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: amaury.forgeotdarc, shinta.nakayama, vinay.sajip
Priority: normal Keywords:

Created on 2012-03-30 06:44 by shinta.nakayama, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (4)
msg157126 - (view) Author: shinta.nakayama (shinta.nakayama) Date: 2012-03-30 06:44
I found a bug in logging module in Windows.
I wrote that at here.

my OS is Windows7 32bit.

Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on win
Type "help", "copyright", "credits" or "license" for more information.
msg157127 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2012-03-30 07:14
Maybe some Antivirus program (or Tortoise) is still scanning the file and python cannot rename it.
Can you try to deactivate the antivirus and try again?
msg157312 - (view) Author: shinta.nakayama (shinta.nakayama) Date: 2012-04-01 16:20
Thank you Armaury.
Allowing your advice,I tried that code on other machine(Windows7 without Antivirus).

But it was same result.
Windows says "process cant access to file. that file is using other process.".
And could not rotate the logs.
msg157339 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2012-04-02 00:16
This is not a logging bug. You called basicConfig with a file name, so the file is opened using a FileHandler and with file name LOG_FILENAME. You then add a RotatingFileHandler with the same name, so the file has two handles referring to it. When the time comes to rotate, the file is still open (with the FileHandler), which is why the rename fails on Windows (though Linux allows it).

Closing as invalid.
Date User Action Args
2022-04-11 14:57:28adminsetgithub: 58655
2012-04-02 00:16:30vinay.sajipsetstatus: open -> closed

nosy: + vinay.sajip
messages: + msg157339

resolution: not a bug
2012-04-01 16:20:09shinta.nakayamasetmessages: + msg157312
2012-03-30 07:14:29amaury.forgeotdarcsetnosy: + amaury.forgeotdarc
messages: + msg157127
2012-03-30 06:44:33shinta.nakayamacreate