Author hewittr
Recipients
Date 2004-06-24.20:43:03
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
I use the RotatingFileHandler in most of my scripts.  The 
script will crash if the RotatingFileHandler encounters a 
locked log file.

I would like to see something like:

    def emit(self, record):
        """
        Emit a record.

        Output the record to the file, catering for rollover 
as described
        in __init__().
        """
        if self.maxBytes > 0:                   # are we rolling 
over?
            msg = "%s\n" % self.format(record)
            self.stream.seek(0, 2)  #due to non-posix-
compliant Windows feature
            if self.stream.tell() + len(msg) >= self.maxBytes:
                try:
                    self.doRollover()
                except Exception:
                    logging.FileHandler.emit(self, 'Failed to 
doRollover.')
        logging.FileHandler.emit(self, record)

My version of Python (2.3.2) had the wrong docstring as 
well, referring to a non-existent setRollover.
History
Date User Action Args
2007-08-23 14:22:56adminlinkissue979252 messages
2007-08-23 14:22:56admincreate