]> granicus.if.org Git - icinga2/commitdiff
Fix required argument for --debug|-x.
authorMichael Friedrich <michael.friedrich@netways.de>
Fri, 23 May 2014 12:12:55 +0000 (14:12 +0200)
committerMichael Friedrich <michael.friedrich@netways.de>
Fri, 23 May 2014 12:12:55 +0000 (14:12 +0200)
Refs #6276

doc/2-getting-started.md
icinga-app/icinga.cpp

index 2ef3b96185db22e9ba410ed072acb8f9d055f62b..9be4fa8e719a380b907343dc7341d4c9e4dcc5ac 100644 (file)
@@ -830,7 +830,7 @@ for historical reasons.
       -D [ --define] args   define a constant
       -c [ --config ] arg   parse a configuration file
       -C [ --validate ]     exit after validating the configuration
-      -x [ --debug ] arg    enable debugging with optional severity level specified
+      -x [ --debug ] arg    enable debugging with severity level specified
       -d [ --daemonize ]    detach from the controlling terminal
       -e [ --errorlog ] arg log fatal errors to the specified log file (only works
                             in combination with --daemonize)
index deefb405a373383c2ecde4b77e0ea3bd5b412e4f..053accab0b66ee2d8638e057710452899581ec84 100644 (file)
@@ -334,7 +334,7 @@ int Main(void)
                ("config,c", po::value<std::vector<std::string> >(), "parse a configuration file")
                ("no-config,z", "start without a configuration file")
                ("validate,C", "exit after validating the configuration")
-               ("debug,x", po::value<std::string>(), "enable debugging with optional severity level specified")
+               ("debug,x", po::value<std::string>(), "enable debugging with severity level specified")
                ("errorlog,e", po::value<std::string>(), "log fatal errors to the specified log file (only works in combination with --daemonize)")
 #ifndef _WIN32
                ("reload-internal", po::value<int>(), "used internally to implement config reload: do not call manually, send SIGHUP instead")
@@ -431,10 +431,15 @@ int Main(void)
        if (g_AppParams.count("debug")) {
                Application::SetDebugging(true);
 
-               String debug_severity = g_AppParams["debug"].as<std::string>();
+               LogSeverity debug_severity;
+               try {
+                       debug_severity = Logger::StringToSeverity(g_AppParams["debug"].as<std::string>());
+               } catch (std::exception&) {
+                       //not set, use default
+                       debug_severity = LogDebug;
+               }
 
-               if (!debug_severity.IsEmpty())
-                       Application::SetDebuggingSeverity(Logger::StringToSeverity(debug_severity));
+               Application::SetDebuggingSeverity(debug_severity);
        }
 
        if (g_AppParams.count("help") || g_AppParams.count("version")) {