mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-15 17:54:33 +02:00
parent
215f500b0e
commit
5ec300f68e
@ -830,7 +830,7 @@ for historical reasons.
|
|||||||
-D [ --define] args define a constant
|
-D [ --define] args define a constant
|
||||||
-c [ --config ] arg parse a configuration file
|
-c [ --config ] arg parse a configuration file
|
||||||
-C [ --validate ] exit after validating the configuration
|
-C [ --validate ] exit after validating the configuration
|
||||||
-x [ --debug ] enable debugging
|
-x [ --debug ] arg enable debugging with optional severity level specified
|
||||||
-d [ --daemonize ] detach from the controlling terminal
|
-d [ --daemonize ] detach from the controlling terminal
|
||||||
-e [ --errorlog ] arg log fatal errors to the specified log file (only works
|
-e [ --errorlog ] arg log fatal errors to the specified log file (only works
|
||||||
in combination with --daemonize)
|
in combination with --daemonize)
|
||||||
|
@ -4,12 +4,6 @@ For a more verbose output of the Icinga 2 daemon increase the
|
|||||||
`severity` attribute of the [logs](#logging) to `notice` or
|
`severity` attribute of the [logs](#logging) to `notice` or
|
||||||
`debug`.
|
`debug`.
|
||||||
|
|
||||||
Additionally you can enable the debug log using
|
|
||||||
|
|
||||||
# icinga2-enable-feature debuglog
|
|
||||||
# service icinga2 restart
|
|
||||||
# tail -f /var/log/icinga2/debug.log
|
|
||||||
|
|
||||||
## <a id="troubleshooting-information-required"></a> Which information is required
|
## <a id="troubleshooting-information-required"></a> Which information is required
|
||||||
|
|
||||||
* Which distribution and version
|
* Which distribution and version
|
||||||
@ -20,6 +14,20 @@ Additionally you can enable the debug log using
|
|||||||
* If the check command failed - what's the output of your manual plugin tests?
|
* If the check command failed - what's the output of your manual plugin tests?
|
||||||
* In case of [debugging](#debug) Icinga 2, the full back traces and outputs
|
* In case of [debugging](#debug) Icinga 2, the full back traces and outputs
|
||||||
|
|
||||||
|
## <a id="troubleshooting-enable-debug-output"></a> Enable Debug Output
|
||||||
|
|
||||||
|
Run Icinga 2 in foreground with debugging enabled You can specify the debug
|
||||||
|
log severity as additional parameter argument to `-x` (or `--debug`). Default
|
||||||
|
is `debug`.
|
||||||
|
|
||||||
|
# /usr/sbin/icinga2 -c /etc/icinga2/icinga2.conf -x notice
|
||||||
|
|
||||||
|
Additionally you can enable the debug log using
|
||||||
|
|
||||||
|
# icinga2-enable-feature debuglog
|
||||||
|
# service icinga2 restart
|
||||||
|
# tail -f /var/log/icinga2/debug.log
|
||||||
|
|
||||||
## <a id="checks-not-executed"></a> Checks are not executed
|
## <a id="checks-not-executed"></a> Checks are not executed
|
||||||
|
|
||||||
* Check the debug log if the check command gets executed
|
* Check the debug log if the check command gets executed
|
||||||
|
@ -334,7 +334,7 @@ int Main(void)
|
|||||||
("config,c", po::value<std::vector<std::string> >(), "parse a configuration file")
|
("config,c", po::value<std::vector<std::string> >(), "parse a configuration file")
|
||||||
("no-config,z", "start without a configuration file")
|
("no-config,z", "start without a configuration file")
|
||||||
("validate,C", "exit after validating the configuration")
|
("validate,C", "exit after validating the configuration")
|
||||||
("debug,x", "enable debugging")
|
("debug,x", po::value<std::string>(), "enable debugging with optional severity level specified")
|
||||||
("errorlog,e", po::value<std::string>(), "log fatal errors to the specified log file (only works in combination with --daemonize)")
|
("errorlog,e", po::value<std::string>(), "log fatal errors to the specified log file (only works in combination with --daemonize)")
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
("reload-internal", po::value<int>(), "used internally to implement config reload: do not call manually, send SIGHUP instead")
|
("reload-internal", po::value<int>(), "used internally to implement config reload: do not call manually, send SIGHUP instead")
|
||||||
@ -428,9 +428,15 @@ int Main(void)
|
|||||||
}
|
}
|
||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 */
|
||||||
|
|
||||||
if (g_AppParams.count("debug"))
|
if (g_AppParams.count("debug")) {
|
||||||
Application::SetDebugging(true);
|
Application::SetDebugging(true);
|
||||||
|
|
||||||
|
String debug_severity = g_AppParams["debug"].as<std::string>();
|
||||||
|
|
||||||
|
if (!debug_severity.IsEmpty())
|
||||||
|
Application::SetDebuggingSeverity(Logger::StringToSeverity(debug_severity));
|
||||||
|
}
|
||||||
|
|
||||||
if (g_AppParams.count("help") || g_AppParams.count("version")) {
|
if (g_AppParams.count("help") || g_AppParams.count("version")) {
|
||||||
String appName = Utility::BaseName(argv[0]);
|
String appName = Utility::BaseName(argv[0]);
|
||||||
|
|
||||||
|
@ -51,6 +51,7 @@ bool Application::m_RequestReopenLogs = false;
|
|||||||
pid_t Application::m_ReloadProcess = 0;
|
pid_t Application::m_ReloadProcess = 0;
|
||||||
static bool l_Restarting = false;
|
static bool l_Restarting = false;
|
||||||
bool Application::m_Debugging = false;
|
bool Application::m_Debugging = false;
|
||||||
|
LogSeverity Application::m_DebuggingSeverity = LogDebug;
|
||||||
int Application::m_ArgC;
|
int Application::m_ArgC;
|
||||||
char **Application::m_ArgV;
|
char **Application::m_ArgV;
|
||||||
double Application::m_StartTime;
|
double Application::m_StartTime;
|
||||||
@ -459,6 +460,29 @@ bool Application::IsDebugging(void)
|
|||||||
return m_Debugging;
|
return m_Debugging;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets debugging severity.
|
||||||
|
*
|
||||||
|
* @param severity Debug log severity.
|
||||||
|
*/
|
||||||
|
void Application::SetDebuggingSeverity(LogSeverity severity)
|
||||||
|
{
|
||||||
|
Application::m_DebuggingSeverity = severity;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the debugging severity of the application.
|
||||||
|
*
|
||||||
|
* @returns severity 'debug' if not set, severity value otherwise.
|
||||||
|
*/
|
||||||
|
LogSeverity Application::GetDebuggingSeverity(void)
|
||||||
|
{
|
||||||
|
if (!Application::m_DebuggingSeverity)
|
||||||
|
return LogDebug;
|
||||||
|
|
||||||
|
return Application::m_DebuggingSeverity;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display version information.
|
* Display version information.
|
||||||
*/
|
*/
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#include "base/application.th"
|
#include "base/application.th"
|
||||||
#include "base/threadpool.h"
|
#include "base/threadpool.h"
|
||||||
#include "base/utility.h"
|
#include "base/utility.h"
|
||||||
|
#include "base/logger_fwd.h"
|
||||||
|
|
||||||
namespace icinga
|
namespace icinga
|
||||||
{
|
{
|
||||||
@ -71,6 +72,9 @@ public:
|
|||||||
static void SetDebugging(bool debug);
|
static void SetDebugging(bool debug);
|
||||||
static bool IsDebugging(void);
|
static bool IsDebugging(void);
|
||||||
|
|
||||||
|
static void SetDebuggingSeverity(LogSeverity severity);
|
||||||
|
static LogSeverity GetDebuggingSeverity(void);
|
||||||
|
|
||||||
void UpdatePidFile(const String& filename, pid_t pid = Utility::GetPid());
|
void UpdatePidFile(const String& filename, pid_t pid = Utility::GetPid());
|
||||||
void ClosePidFile(bool unlink);
|
void ClosePidFile(bool unlink);
|
||||||
static pid_t ReadPidFile(const String& filename);
|
static pid_t ReadPidFile(const String& filename);
|
||||||
@ -137,6 +141,7 @@ private:
|
|||||||
static char **m_ArgV; /**< Command-line arguments. */
|
static char **m_ArgV; /**< Command-line arguments. */
|
||||||
FILE *m_PidFile; /**< The PID file */
|
FILE *m_PidFile; /**< The PID file */
|
||||||
static bool m_Debugging; /**< Whether debugging is enabled. */
|
static bool m_Debugging; /**< Whether debugging is enabled. */
|
||||||
|
static LogSeverity m_DebuggingSeverity; /**< Whether debugging severity is set. */
|
||||||
static double m_StartTime;
|
static double m_StartTime;
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
|
@ -108,7 +108,7 @@ void icinga::Log(LogSeverity severity, const String& facility,
|
|||||||
LogSeverity defaultLogLevel;
|
LogSeverity defaultLogLevel;
|
||||||
|
|
||||||
if (Application::IsDebugging())
|
if (Application::IsDebugging())
|
||||||
defaultLogLevel = LogDebug;
|
defaultLogLevel = Application::GetDebuggingSeverity();
|
||||||
else
|
else
|
||||||
defaultLogLevel = LogInformation;
|
defaultLogLevel = LogInformation;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user