Commit a0f6cda5 authored by Andreas Gustafsson's avatar Andreas Gustafsson
Browse files

the 'default_debug' log channel was not set up when

'category default' was present in the config file
parent b22879b0
129. [bug] The 'default_debug' log channel was not set up when
'category default' was present in the config file
128. [cleanup] <isc/dir.h> had ISC_LANG_BEGINDECLS instead of
ISC_LANG_ENDDECLS at end of header.
......
......@@ -48,7 +48,18 @@ isc_result_t
ns_log_init(void);
isc_result_t
ns_log_setdefaults(isc_logconfig_t *lcfg);
ns_log_setdefaultchannels(isc_logconfig_t *lcfg);
/*
* Set up logging channels according to the named defaults, which
* may differ from the logging library defaults. Currently,
* this just means setting up default_debug.
*/
isc_result_t
ns_log_setdefaultcategory(isc_logconfig_t *lcfg);
/*
* Set up "category default" to go to the right places.
*/
void
ns_log_shutdown(void);
......
......@@ -79,7 +79,10 @@ ns_log_init(void) {
isc_log_registermodules(ns_g_lctx, ns_g_modules);
dns_log_init(ns_g_lctx);
result = ns_log_setdefaults(lcfg);
result = ns_log_setdefaultchannels(lcfg);
if (result != ISC_R_SUCCESS)
goto cleanup;
result = ns_log_setdefaultcategory(lcfg);
if (result != ISC_R_SUCCESS)
goto cleanup;
......@@ -92,7 +95,7 @@ ns_log_init(void) {
}
isc_result_t
ns_log_setdefaults(isc_logconfig_t *lcfg) {
ns_log_setdefaultchannels(isc_logconfig_t *lcfg) {
isc_result_t result;
isc_logdestination_t destination;
......@@ -116,6 +119,21 @@ ns_log_setdefaults(isc_logconfig_t *lcfg) {
goto cleanup;
}
/*
* Set the initial debug level.
*/
isc_log_setdebuglevel(ns_g_lctx, ns_g_debuglevel);
result = ISC_R_SUCCESS;
cleanup:
return (result);
}
isc_result_t
ns_log_setdefaultcategory(isc_logconfig_t *lcfg) {
isc_result_t result;
result = isc_log_usechannel(lcfg, "default_syslog",
ISC_LOGCATEGORY_DEFAULT, NULL);
if (result != ISC_R_SUCCESS)
......@@ -126,12 +144,7 @@ ns_log_setdefaults(isc_logconfig_t *lcfg) {
if (result != ISC_R_SUCCESS)
goto cleanup;
/*
* Set the initial debug level.
*/
isc_log_setdebuglevel(ns_g_lctx, ns_g_debuglevel);
return (ISC_R_SUCCESS);
result = ISC_R_SUCCESS;
cleanup:
return (result);
......
......@@ -150,6 +150,8 @@ ns_log_configure(isc_logconfig_t *lcctx, dns_c_logginglist_t *clog) {
dns_c_logcat_t *ccat;
isc_boolean_t default_set = ISC_FALSE;
CHECK(ns_log_setdefaultchannels(lcctx));
for (cchan = ISC_LIST_HEAD(clog->channels);
cchan != NULL;
cchan = ISC_LIST_NEXT(cchan, next)) {
......@@ -166,7 +168,7 @@ ns_log_configure(isc_logconfig_t *lcctx, dns_c_logginglist_t *clog) {
}
if (! default_set)
CHECK(ns_log_setdefaults(lcctx));
CHECK(ns_log_setdefaultcategory(lcctx));
return (ISC_R_SUCCESS);
......
......@@ -1314,12 +1314,15 @@ load_configuration(const char *filename, ns_server_t *server,
"creating new logging configuration");
(void) dns_c_ctx_getlogging(cctx, &clog);
if (clog != NULL)
if (clog != NULL) {
CHECKM(ns_log_configure(logc, clog),
"configuring logging");
else
CHECKM(ns_log_setdefaults(logc),
"setting up default logging defaults");
} else {
CHECKM(ns_log_setdefaultchannels(logc),
"setting up default logging channels");
CHECKM(ns_log_setdefaultcategory(logc),
"setting up default 'category default'");
}
result = isc_logconfig_use(ns_g_lctx, logc);
if (result != ISC_R_SUCCESS) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment