]> granicus.if.org Git - icinga2/commitdiff
Add support for config validation log timestamps 6285/head
authorMichael Friedrich <michael.friedrich@icinga.com>
Thu, 3 May 2018 09:35:29 +0000 (11:35 +0200)
committerMichael Friedrich <michael.friedrich@icinga.com>
Thu, 3 May 2018 09:35:29 +0000 (11:35 +0200)
This also adds implicit support for the startup.log
generated from API config package validation, e.g. used by
the Icinga Director.

fixes #3455

icinga-app/icinga.cpp
lib/base/logger.cpp
lib/base/logger.hpp
lib/cli/daemoncommand.cpp

index 34aeddb69657e812d9ac5bebe55eeb3aa68f4fa4..c63c1c822f4f21465ce75f87462753d168c44f3b 100644 (file)
@@ -476,7 +476,7 @@ static int Main()
                        &GlobalArgumentCompletion, true, autoindex);
                rc = 0;
        } else if (command) {
-               Logger::DisableTimestamp(true);
+               Logger::DisableTimestamp();
 #ifndef _WIN32
                if (command->GetImpersonationLevel() == ImpersonateRoot) {
                        if (getuid() != 0) {
index 1ff1d14c4480b65c58673759eb5ae716eda78f42..8c20231fb881af58fb1e20aadc79c8cacb3a9f14 100644 (file)
@@ -173,9 +173,14 @@ LogSeverity Logger::GetConsoleLogSeverity()
        return m_ConsoleLogSeverity;
 }
 
-void Logger::DisableTimestamp(bool disable)
+void Logger::DisableTimestamp()
 {
-       m_TimestampEnabled = !disable;
+       m_TimestampEnabled = false;
+}
+
+void Logger::EnableTimestamp()
+{
+       m_TimestampEnabled = true;
 }
 
 bool Logger::IsTimestampEnabled()
index 1459e6efa9048e7646dc38b35af5071192d12246..31ed6c82123d347a66948b0b0766d096f9c80879 100644 (file)
@@ -84,7 +84,8 @@ public:
        static void DisableConsoleLog();
        static void EnableConsoleLog();
        static bool IsConsoleLogEnabled();
-       static void DisableTimestamp(bool);
+       static void DisableTimestamp();
+       static void EnableTimestamp();
        static bool IsTimestampEnabled();
 
        static void SetConsoleLogSeverity(LogSeverity logSeverity);
index 5b34bc18dc475fe160bf80cccb7b75bcfca655b8..d113dac11357c9986e67e593d27dddd4499c0cd2 100644 (file)
@@ -183,8 +183,7 @@ std::vector<String> DaemonCommand::GetArgumentSuggestions(const String& argument
  */
 int DaemonCommand::Run(const po::variables_map& vm, const std::vector<std::string>& ap) const
 {
-       if (!vm.count("validate"))
-               Logger::DisableTimestamp(false);
+       Logger::EnableTimestamp();
 
        Log(LogInformation, "cli")
                << "Icinga application loader (version: " << Application::GetAppVersion()