[icinga-checkins] icinga.org: icinga2/next: Disable console log after activating all config items

git at icinga.org git at icinga.org
Tue Jun 24 13:04:45 CEST 2014


Module: icinga2
Branch: next
Commit: ec903058efd378338bea980e96da6cb4118df88a
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=ec903058efd378338bea980e96da6cb4118df88a

Author: Gunnar Beutner <gunnar.beutner at netways.de>
Date:   Tue Jun 24 13:04:07 2014 +0200

Disable console log after activating all config items

fixes #6316

---

 icinga-app/icinga.cpp |   16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/icinga-app/icinga.cpp b/icinga-app/icinga.cpp
index ce12db1..7739171 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<std::string>();
@@ -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;



More information about the icinga-checkins mailing list