From fd5776aac21cee4ca8386c81d7d85d0a3c340fe8 Mon Sep 17 00:00:00 2001 From: xperia64 Date: Sun, 3 Jan 2021 19:53:23 +0000 Subject: Delete the old log file before rotating (#5675) --- src/common/logging/backend.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/common/logging') diff --git a/src/common/logging/backend.cpp b/src/common/logging/backend.cpp index 7c9da6895..bec931ceb 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"); } -- cgit v1.2.3