Message106043
the function below is used to determine the proper file name of the next log file. But the question is if I set a large number of self.backupCount like 10000000, it will take too long to calculate the right file name. I think it could be a better way to do this instead of finding from the end.
def doRollover(self):
"""
Do a rollover, as described in __init__().
"""
self.stream.close()
if self.backupCount > 0:
for i in range(self.backupCount - 1, 0, -1):
sfn = "%s.%d" % (self.baseFilename, i)
dfn = "%s.%d" % (self.baseFilename, i + 1)
if os.path.exists(sfn):
#print "%s -> %s" % (sfn, dfn)
if os.path.exists(dfn):
os.remove(dfn)
os.rename(sfn, dfn)
dfn = self.baseFilename + ".1"
if os.path.exists(dfn):
os.remove(dfn)
os.rename(self.baseFilename, dfn)
#print "%s -> %s" % (self.baseFilename, dfn)
self.mode = 'w'
self.stream = self._open() |
|
Date |
User |
Action |
Args |
2010-05-19 10:56:44 | davy.zhang | set | recipients:
+ davy.zhang |
2010-05-19 10:56:44 | davy.zhang | set | messageid: <1274266604.24.0.270763712229.issue8764@psf.upfronthosting.co.za> |
2010-05-19 10:56:42 | davy.zhang | link | issue8764 messages |
2010-05-19 10:56:42 | davy.zhang | create | |
|