From fd5776aac21cee4ca8386c81d7d85d0a3c340fe8 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 7c9da6895b..bec931cebb 100644 --- a/src/common/logging/backend.cpp +++ b/src/common/logging/backend.cpp @@ -146,6 +146,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"); }