Adjusted crash_gen tool to save old log files, instead of deleting them
This commit is contained in:
parent
032d93b59a
commit
7722eb55ea
|
@ -2455,11 +2455,16 @@ class TdeSubProcess:
|
||||||
# Delete the log files
|
# Delete the log files
|
||||||
logPath = self.getBuildPath() + "/test/log"
|
logPath = self.getBuildPath() + "/test/log"
|
||||||
# ref: https://stackoverflow.com/questions/1995373/deleting-all-files-in-a-directory-with-python/1995397
|
# ref: https://stackoverflow.com/questions/1995373/deleting-all-files-in-a-directory-with-python/1995397
|
||||||
filelist = [ f for f in os.listdir(logPath) ] # if f.endswith(".bak") ]
|
# filelist = [ f for f in os.listdir(logPath) ] # if f.endswith(".bak") ]
|
||||||
for f in filelist:
|
# for f in filelist:
|
||||||
filePath = os.path.join(logPath, f)
|
# filePath = os.path.join(logPath, f)
|
||||||
print("Removing log file: {}".format(filePath))
|
# print("Removing log file: {}".format(filePath))
|
||||||
os.remove(filePath)
|
# os.remove(filePath)
|
||||||
|
logPathSaved = logPath + "_" + time.strftime('%Y-%m-%d-%H-%M-%S')
|
||||||
|
logger.info("Saving old log files to: {}".format(logPathSaved))
|
||||||
|
os.rename(logPath, logPathSaved)
|
||||||
|
os.mkdir(logPath) # recreate
|
||||||
|
|
||||||
|
|
||||||
svcCmd = [taosdPath, '-c', cfgPath]
|
svcCmd = [taosdPath, '-c', cfgPath]
|
||||||
# svcCmd = ['vmstat', '1']
|
# svcCmd = ['vmstat', '1']
|
||||||
|
|
Loading…
Reference in New Issue