RotatingFileHandler + subprocess module problems

Stephen Hansen shansen at
Thu Jan 11 19:59:51 CET 2007

Hey, there.

I'm currently having a problem with what *looks* like an interaction between
using subprocess and RotatingFileHandler.

This is on Windows with Python 2.3

I have two console applications: app1 and app2.

For most of app2 to function properly, app1 must already be running.

App1 logs to c:\app1.log. App2 logs to c:\app2.log, both using
RotatingFileHandler from the logging module.

If I run app1, and then app2, it all works fine. Specifically, the apps are
logging correctly and I can see with Process Explorer that each has a handle
to the appropriate files.

However, I have a setting to make App2 run App1 in the background for
convienance. This is using the subprocess module. When this setting is on,
App2 will die horribly the first time that the doRollover comes along:
specifically it gets a permission denied error when it tries to rename
App2.log to App2.log.1

After doing some debugging, it appears that App1 (if started by App2 using
the subprocess module) has a handle to App2.log /somehow/. It never starts
it, or touches it (verified through debug messages), but seems to inherit

Is there anything obvious I'm doing wrong? :) If it doesn't jump out at
anyone, I'll write up a mockup. I'm hoping I just did something of a goof
that will be obvious though, since the apps are a bit complicated and
distilling them down to a testcase will be mildly annoying. :)

Thanks in advance.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list