logging: allow DEBUG messages to syslog during startup

This commit is contained in:
Thomas Ries 2020-07-26 09:40:23 +00:00
parent 0210990c1f
commit 88b0968178
2 changed files with 8 additions and 7 deletions

View File

@ -324,7 +324,7 @@ void log_debug(unsigned int class, char *file, int line, const char *format, ...
output_to_stderr("", ap, file, line, format);
if (!log_to_stderr && silence_level < 1) {
if (silence_level < 1) {
output_to_syslog("", LOG_DEBUG, ap, file, line, format);
}

View File

@ -150,8 +150,13 @@ int main (int argc, char *argv[])
char *pidfilename=NULL;
struct sigaction act;
/*
* initialize the loggin subsystem
*/
log_init();
/* set log silencing for syslog as requested in config */
log_set_silence(configuration.silence_log);
/* while not daemonized, log also to stderr */
log_set_stderr(1);
/*
@ -276,6 +281,7 @@ int main (int argc, char *argv[])
setsid();
if (fork()!=0) exit(0);
/* we are daemonizing, no more logging to stderr */
log_set_stderr(0);
/* detach STDIN/OUT/ERR file */
@ -343,11 +349,6 @@ int main (int argc, char *argv[])
/* initialize the registration facility */
register_init();
/*
* silence the log - if so required...
*/
log_set_silence(configuration.silence_log);
INFO(PACKAGE"-"VERSION"-"BUILDSTR" "BUILDDATE" "UNAME" started");
/*****************************