[Python-Dev] PEP 282 Implementation

Vinay Sajip vinay_sajip@red-dove.com
Tue, 24 Sep 2002 08:56:33 +0100


Chris McDonough wrote:
> It would be helpful for the FileHandler class to define a method
> which just closes and reopens the current logfile (instead of
> actually rotating a set like-named logfiles).  This would allow
> logfile rotation to be performed by a separate process (e.g.
> RedHat's logrotate).  Sometimes it's better (and even necessary) to
> be able to use system-provided log rotation facilities instead of
> relying on the native rotation facilities.

I'm not sure whether this should be in the core functionality. I presume you
don't mean an atomic "close and reopen" operation - rather, are you
suggesting close the file, maybe rename it at the application level, then
reopen? If so, then it's best handled entirely in the application level,
through a subclass of FileHandler. This allows each application to consider
issues such as what to do with events that occur between close and reopen
(e.g. if multiple threads are running).

Regards

Vinay