fix: Only use MS debug outputter when the process is daemonized
This commit is contained in:
parent
66acf9038b
commit
220711c2d7
1 changed files with 8 additions and 6 deletions
|
|
@ -121,12 +121,6 @@ int DaemonApp::run(int argc, char **argv)
|
||||||
|
|
||||||
bool uninstall = false;
|
bool uninstall = false;
|
||||||
try {
|
try {
|
||||||
#if SYSAPI_WIN32
|
|
||||||
// TODO: maybe we should only add this if not using /f?
|
|
||||||
// sends debug messages to visual studio console window.
|
|
||||||
log.insert(new MSWindowsDebugOutputter());
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// default log level to system setting.
|
// default log level to system setting.
|
||||||
if (string logLevel = arch.setting("LogLevel"); logLevel != "")
|
if (string logLevel = arch.setting("LogLevel"); logLevel != "")
|
||||||
log.setFilter(logLevel.c_str());
|
log.setFilter(logLevel.c_str());
|
||||||
|
|
@ -159,6 +153,14 @@ int DaemonApp::run(int argc, char **argv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if SYSAPI_WIN32
|
||||||
|
if (!foreground) {
|
||||||
|
// Only use MS debug outputter when the process is daemonized, since stdout won't be accessible
|
||||||
|
// in that case, but is accessible when running in the foreground.
|
||||||
|
log.insert(new MSWindowsDebugOutputter()); // NOSONAR -- Adopted by `Log`
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (foreground) {
|
if (foreground) {
|
||||||
LOG((CLOG_PRINT "starting daemon in foreground"));
|
LOG((CLOG_PRINT "starting daemon in foreground"));
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue