2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-01 06:55:30 +00:00

the 'default_debug' log channel was not set up when

'category default' was present in the config file
This commit is contained in:
Andreas Gustafsson
2000-04-28 18:53:45 +00:00
parent b22879b057
commit a0f6cda5fd
5 changed files with 46 additions and 14 deletions

View File

@@ -1,3 +1,6 @@
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 128. [cleanup] <isc/dir.h> had ISC_LANG_BEGINDECLS instead of
ISC_LANG_ENDDECLS at end of header. ISC_LANG_ENDDECLS at end of header.

View File

@@ -48,7 +48,18 @@ isc_result_t
ns_log_init(void); ns_log_init(void);
isc_result_t 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 void
ns_log_shutdown(void); ns_log_shutdown(void);

View File

@@ -79,7 +79,10 @@ ns_log_init(void) {
isc_log_registermodules(ns_g_lctx, ns_g_modules); isc_log_registermodules(ns_g_lctx, ns_g_modules);
dns_log_init(ns_g_lctx); 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) if (result != ISC_R_SUCCESS)
goto cleanup; goto cleanup;
@@ -92,7 +95,7 @@ ns_log_init(void) {
} }
isc_result_t isc_result_t
ns_log_setdefaults(isc_logconfig_t *lcfg) { ns_log_setdefaultchannels(isc_logconfig_t *lcfg) {
isc_result_t result; isc_result_t result;
isc_logdestination_t destination; isc_logdestination_t destination;
@@ -116,6 +119,21 @@ ns_log_setdefaults(isc_logconfig_t *lcfg) {
goto cleanup; 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", result = isc_log_usechannel(lcfg, "default_syslog",
ISC_LOGCATEGORY_DEFAULT, NULL); ISC_LOGCATEGORY_DEFAULT, NULL);
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
@@ -126,12 +144,7 @@ ns_log_setdefaults(isc_logconfig_t *lcfg) {
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
goto cleanup; goto cleanup;
/* result = ISC_R_SUCCESS;
* Set the initial debug level.
*/
isc_log_setdebuglevel(ns_g_lctx, ns_g_debuglevel);
return (ISC_R_SUCCESS);
cleanup: cleanup:
return (result); return (result);

View File

@@ -150,6 +150,8 @@ ns_log_configure(isc_logconfig_t *lcctx, dns_c_logginglist_t *clog) {
dns_c_logcat_t *ccat; dns_c_logcat_t *ccat;
isc_boolean_t default_set = ISC_FALSE; isc_boolean_t default_set = ISC_FALSE;
CHECK(ns_log_setdefaultchannels(lcctx));
for (cchan = ISC_LIST_HEAD(clog->channels); for (cchan = ISC_LIST_HEAD(clog->channels);
cchan != NULL; cchan != NULL;
cchan = ISC_LIST_NEXT(cchan, next)) { 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) if (! default_set)
CHECK(ns_log_setdefaults(lcctx)); CHECK(ns_log_setdefaultcategory(lcctx));
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);

View File

@@ -1314,12 +1314,15 @@ load_configuration(const char *filename, ns_server_t *server,
"creating new logging configuration"); "creating new logging configuration");
(void) dns_c_ctx_getlogging(cctx, &clog); (void) dns_c_ctx_getlogging(cctx, &clog);
if (clog != NULL) if (clog != NULL) {
CHECKM(ns_log_configure(logc, clog), CHECKM(ns_log_configure(logc, clog),
"configuring logging"); "configuring logging");
else } else {
CHECKM(ns_log_setdefaults(logc), CHECKM(ns_log_setdefaultchannels(logc),
"setting up default logging defaults"); "setting up default logging channels");
CHECKM(ns_log_setdefaultcategory(logc),
"setting up default 'category default'");
}
result = isc_logconfig_use(ns_g_lctx, logc); result = isc_logconfig_use(ns_g_lctx, logc);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {