From: Gunnar Beutner Date: Tue, 24 Jun 2014 11:04:07 +0000 (+0200) Subject: Disable console log after activating all config items X-Git-Tag: v2.0.1~41 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ec903058efd378338bea980e96da6cb4118df88a;p=icinga2 Disable console log after activating all config items fixes #6316 --- diff --git a/icinga-app/icinga.cpp b/icinga-app/icinga.cpp index ce12db189..773917199 100644 --- a/icinga-app/icinga.cpp +++ b/icinga-app/icinga.cpp @@ -185,7 +185,7 @@ static bool Daemonize(void) } while (readpid != pid && ret == 0); if (ret == pid) { - Log(LogCritical, "icinga-app", "The daemon could not be started. See logfile for details."); + Log(LogCritical, "icinga-app", "The daemon could not be started. See log output for details."); exit(EXIT_FAILURE); } else if (ret == -1) { std::ostringstream msgbuf; @@ -546,7 +546,15 @@ int Main(void) return EXIT_FAILURE; } } + } + + // activate config only after daemonization: it starts threads and that is not compatible with fork() + if (!ConfigItem::ActivateItems()) { + Log(LogCritical, "icinga-app", "Error activating configuration."); + return EXIT_FAILURE; + } + if (g_AppParams.count("daemonize")) { String errorLog; if (g_AppParams.count("errorlog")) errorLog = g_AppParams["errorlog"].as(); @@ -554,12 +562,6 @@ int Main(void) SetDaemonIO(errorLog); Logger::DisableConsoleLog(); } - - // activate config only after daemonization: it starts threads and that is not compatible with fork() - if (!ConfigItem::ActivateItems()) { - Log(LogCritical, "icinga-app", "Error activating configuration."); - return EXIT_FAILURE; - } #ifndef _WIN32 struct sigaction sa;