[Python-Dev] PEP 282 Implementation
Mon, 23 Sep 2002 23:22:01 -0400
> > > - setRollover(): the explanation isn't 100% clear. I *think*
> > > you always write to "app.log", and when that's full, you
> > > it to app.log.1, and app.log.1 gets renamed to app.log.2,
> > > on, and then you start writing to a new app.log, right?
> > Yes. The original implementation was different - it just closed
> > current file and opened a new file app.log.n. The current
> > implementation is slightly slower due to the need to rename
> > files, but the user can tell more easily which the latest log
> > is. I will update the setRollover() docstring to indicate more
> > clearly how it works; I'm assuming that the current algorithm is
> > deemed good enough.
> Yes, this seems how log rotation is generally done. (Please
> the commented-out old code.)
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.