Fix performance degradation in :class:`logging.handlers.RotatingFileHandler`. Patch by Craig Robson.