From c1d7ba4d60da30e0dffe763c0d654763c98895a3 Mon Sep 17 00:00:00 2001 From: xperia64 Date: Sun, 3 Jan 2021 19:53:23 +0000 Subject: [PATCH] Delete the old log file before rotating (#5675) --- src/common/logging/backend.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/common/logging/backend.cpp b/src/common/logging/backend.cpp index b708db793..90608157e 100644 --- a/src/common/logging/backend.cpp +++ b/src/common/logging/backend.cpp @@ -145,6 +145,9 @@ void ColorConsoleBackend::Write(const Entry& entry) { } FileBackend::FileBackend(const std::string& filename) : bytes_written(0) { + if (FileUtil::Exists(filename + ".old.txt")) { + FileUtil::Delete(filename + ".old.txt"); + } if (FileUtil::Exists(filename)) { FileUtil::Rename(filename, filename + ".old.txt"); }