mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-26 07:04:37 +02:00
Merge pull request #7961 from Icinga/bugfix/startup-log
Place startup.log and status in /var/lib/icinga2/api, not /var/lib/icinga2/api/zones-stage
This commit is contained in:
commit
0e880048ee
@ -592,15 +592,16 @@ void ApiListener::TryActivateZonesStage(const std::vector<String>& relativePaths
|
|||||||
process->Run();
|
process->Run();
|
||||||
const ProcessResult& pr = process->WaitForResult();
|
const ProcessResult& pr = process->WaitForResult();
|
||||||
|
|
||||||
|
String apiDir = GetApiDir();
|
||||||
String apiZonesDir = GetApiZonesDir();
|
String apiZonesDir = GetApiZonesDir();
|
||||||
String apiZonesStageDir = GetApiZonesStageDir();
|
String apiZonesStageDir = GetApiZonesStageDir();
|
||||||
|
|
||||||
String logFile = apiZonesStageDir + "/startup.log";
|
String logFile = apiDir + "/zones-stage-startup.log";
|
||||||
std::ofstream fpLog(logFile.CStr(), std::ofstream::out | std::ostream::binary | std::ostream::trunc);
|
std::ofstream fpLog(logFile.CStr(), std::ofstream::out | std::ostream::binary | std::ostream::trunc);
|
||||||
fpLog << pr.Output;
|
fpLog << pr.Output;
|
||||||
fpLog.close();
|
fpLog.close();
|
||||||
|
|
||||||
String statusFile = apiZonesStageDir + "/status";
|
String statusFile = apiDir + "/zones-stage-status";
|
||||||
std::ofstream fpStatus(statusFile.CStr(), std::ofstream::out | std::ostream::binary | std::ostream::trunc);
|
std::ofstream fpStatus(statusFile.CStr(), std::ofstream::out | std::ostream::binary | std::ostream::trunc);
|
||||||
fpStatus << pr.ExitStatus;
|
fpStatus << pr.ExitStatus;
|
||||||
fpStatus.close();
|
fpStatus.close();
|
||||||
@ -644,10 +645,15 @@ void ApiListener::TryActivateZonesStage(const std::vector<String>& relativePaths
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String failedLogFile = apiDir + "/zones-stage-startup-last-failed.log";
|
||||||
|
std::ofstream fpFailedLog(failedLogFile.CStr(), std::ofstream::out | std::ostream::binary | std::ostream::trunc);
|
||||||
|
fpFailedLog << pr.Output;
|
||||||
|
fpFailedLog.close();
|
||||||
|
|
||||||
// Error case.
|
// Error case.
|
||||||
Log(LogCritical, "ApiListener")
|
Log(LogCritical, "ApiListener")
|
||||||
<< "Config validation failed for staged cluster config sync in '" << apiZonesStageDir
|
<< "Config validation failed for staged cluster config sync in '" << apiZonesStageDir
|
||||||
<< "'. Aborting. Logs: '" << logFile << "'";
|
<< "'. Aborting. Logs: '" << failedLogFile << "'";
|
||||||
|
|
||||||
ApiListener::Ptr listener = ApiListener::GetInstance();
|
ApiListener::Ptr listener = ApiListener::GetInstance();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user