[ python-Feature Requests-1567331 ] logging.RotatingFileHandler has no "infinite" backupCount

SourceForge.net noreply at sourceforge.net
Mon Jan 15 17:44:13 CET 2007


Feature Requests item #1567331, was opened at 2006-09-28 21:36
Message generated for change (Comment added) made by vsajip
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1567331&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: None
>Status: Closed
>Resolution: Fixed
Priority: 5
Private: No
Submitted By: Skip Montanaro (montanaro)
Assigned to: Vinay Sajip (vsajip)
Summary: logging.RotatingFileHandler has no "infinite" backupCount

Initial Comment:
It seems to me that logging.RotatingFileHandler should
have a way to spell "never delete old log files".  This
is useful in situations where you want an external
process (manual or automatic) make decisions about
deleting log files.


----------------------------------------------------------------------

>Comment By: Vinay Sajip (vsajip)
Date: 2007-01-15 16:44

Message:
Logged In: YES 
user_id=308438
Originator: NO

The problem with this is that on rollover, RotatingFileHandler renames old
logs: rollover.log.3 -> rollover.log.4, rollover.log.2 -> rollover.log.3,
rollover.log.1 -> rollover.log.2, rollover.log -> rollover.log.1, and a new
rollover.log is opened. With an arbitrary number of old log files, this
leads to arbitrary renaming time - which could cause long pauses due to
logging, not a good idea.

If you are using e.g. logrotate or newsyslog, or a custom program to do
logfile rotation, you can use the new logging.handlers.WatchedFileHandler
handler (meant for use on Unix/Linux only - on Windows, logfiles can't be
renamed or moved while in use and so the requirement doesn't arise) which
watches the logged-to file to see when it changes. This has recently been
checked into SVN trunk.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1567331&group_id=5470


More information about the Python-bugs-list mailing list