[Python-Dev] Re: PEP 282 Implementation

Michael Chermside mcherm@destiny.com
Wed, 28 Aug 2002 12:49:51 -0400

>> - setRollover(): the explanation isn't 100% clear.  I *think* that you
>>   always write to "app.log", and when that's full, you rename it to
>>   app.log.1, and app.log.1 gets renamed to app.log.2, and so on, and
>>   then you start writing to a new app.log, right?
> Yes. The original implementation was different - it just closed the current
> file and opened a new file app.log.n. The current implementation is slightly
> slower due to the need to rename several files, but the user can tell more
> easily which the latest log file 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.

Why not have the current logfile named "app.log", and when it's full 
rename it as "app.log.n" (for the approprite value of n)? It's still 
easy to find the current log file, there's only one file to rename, and 
the obvious sort order will put the files in chronlogical order not 
reverse chronological order.

The only downside that's obvious to me is that if you just clear out old 
log files by deleting all but the latest 3, then your numbers will keep 
increasing over time. But I hardly see that as a problem... if you find 
that a filename of "app.log.143" really drives you crazy you can just 
rename the remaining logfiles the next time you clean out the log 
directory and everything's fine.

-- Michael Chermside