diff --git a/lib/remote/apilistener.cpp b/lib/remote/apilistener.cpp index 85443e21850..b71250376e6 100644 --- a/lib/remote/apilistener.cpp +++ b/lib/remote/apilistener.cpp @@ -1375,7 +1375,6 @@ void ApiListener::OpenLogFile() } m_LogFile = new StdioStream(fp.release(), true); - m_LogMessageCount = 0; SetLogMessageTimestamp(Utility::GetTime()); } @@ -1405,6 +1404,9 @@ void ApiListener::RotateLogFile() if (!Utility::PathExists(newpath)) { try { Utility::RenameFile(oldpath, newpath); + + // We're rotating the current log file, so reset the log message counter as well. + m_LogMessageCount = 0; } catch (const std::exception& ex) { Log(LogCritical, "ApiListener") << "Cannot rotate replay log file from '" << oldpath << "' to '"