mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-26 23:24:09 +02:00
Merge pull request #9999 from Icinga/reset-log-message-count-correctly
ApiListener: Reset `m_LogMessageCount` when rotating
This commit is contained in:
commit
7d1c887a32
@ -1375,7 +1375,6 @@ void ApiListener::OpenLogFile()
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_LogFile = new StdioStream(fp.release(), true);
|
m_LogFile = new StdioStream(fp.release(), true);
|
||||||
m_LogMessageCount = 0;
|
|
||||||
SetLogMessageTimestamp(Utility::GetTime());
|
SetLogMessageTimestamp(Utility::GetTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1405,6 +1404,9 @@ void ApiListener::RotateLogFile()
|
|||||||
if (!Utility::PathExists(newpath)) {
|
if (!Utility::PathExists(newpath)) {
|
||||||
try {
|
try {
|
||||||
Utility::RenameFile(oldpath, newpath);
|
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) {
|
} catch (const std::exception& ex) {
|
||||||
Log(LogCritical, "ApiListener")
|
Log(LogCritical, "ApiListener")
|
||||||
<< "Cannot rotate replay log file from '" << oldpath << "' to '"
|
<< "Cannot rotate replay log file from '" << oldpath << "' to '"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user