From: Evan Hunt Date: Tue, 13 May 2025 07:56:08 +0000 (-0700) Subject: debug level was ignored when logging to stderr X-Git-Tag: v9.21.9~48^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=96333bc6d72b2ad126914e82492016707fba6275;p=thirdparty%2Fbind9.git debug level was ignored when logging to stderr In commit cc167266aa, the -g option was changed so it sets both named_g_logstderr and also named_g_logflags to use ISO style timestamps with tzinfo. Together with an error in named_log_setsafechannels(), that change could cause the debugging level to be ignored. --- diff --git a/bin/named/log.c b/bin/named/log.c index 1afc0d4f2d2..e4867ffbc52 100644 --- a/bin/named/log.c +++ b/bin/named/log.c @@ -126,18 +126,20 @@ named_log_setsafechannels(isc_logconfig_t *lcfg) { * discarded a bit faster. */ isc_log_setdebuglevel(0); - } else if (named_g_logstderr && (named_g_logflags != 0)) { + } else if (named_g_logflags != 0) { /* - * If the option -g is given, but we also requested iso - * timestamps, we'll still need to override the "default_debug" - * logger with a new one. + * The -g option sets logstderr, and also sets logflags + * to print ISO timestamps. Since that isn't the default + * behavior, we need to override the "default_debug" + * channel with a new one. */ isc_log_createchannel(lcfg, "default_debug", ISC_LOG_TOFILEDESC, ISC_LOG_DYNAMIC, ISC_LOGDESTINATION_STDERR, - ISC_LOG_PRINTTIME | named_g_logflags); - } else { + named_g_logflags); isc_log_setdebuglevel(named_g_debuglevel); + } else { + UNREACHABLE(); } if (named_g_logfile != NULL) {