[LOGGING]: Fix multi-rollover
When there is a long difference between the last time a log was opened and now there is a multi-rotate scenario which leaves the log files in a bit of a mess. This is typically seen on a worker that is spun up from an image. This stops the multi-rotate scenario from happening in Python's on log handler so should work for us. Change-Id: I5b07d52965e497adf229acef9e5a040e50729849
This commit is contained in:
@@ -85,7 +85,9 @@ class CompressedTimedRotatingFileHandler(
|
||||
self.stream = codecs.open(self.baseFilename, 'w', self.encoding)
|
||||
else:
|
||||
self.stream = open(self.baseFilename, 'w')
|
||||
self.rolloverAt = self.rolloverAt + self.interval
|
||||
currentTime = int(time.time())
|
||||
while self.rolloverAt <= currentTime:
|
||||
self.rolloverAt = self.rolloverAt + self.interval
|
||||
zfile = '{0}.gz'.format(tfn)
|
||||
if os.path.exists(zfile):
|
||||
os.remove(zfile)
|
||||
|
||||
Reference in New Issue
Block a user