diff --git a/CHANGES b/CHANGES index d03ebdddec..13c9a23f46 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,5 @@ + 866. [func] Close debug only file channels when debug is set to + zero. [RT #1246] 865. [bug] The new configuration parser did not allow the optional debug level in a "severity debug" diff --git a/lib/isc/log.c b/lib/isc/log.c index 25777c610a..523cd01adc 100644 --- a/lib/isc/log.c +++ b/lib/isc/log.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: log.c,v 1.65 2001/06/04 19:33:24 tale Exp $ */ +/* $Id: log.c,v 1.66 2001/06/08 02:57:13 marka Exp $ */ /* Principal Authors: DCL */ @@ -931,9 +931,24 @@ isc_log_setcontext(isc_log_t *lctx) { void isc_log_setdebuglevel(isc_log_t *lctx, unsigned int level) { + isc_logchannel_t *channel; + REQUIRE(VALID_CONTEXT(lctx)); lctx->debug_level = level; + /* + * Close ISC_LOG_DEBUGONLY channels if level is zero. + */ + if (lctx->debug_level == 0) + for (channel = ISC_LIST_HEAD(lctx->logconfig->channels); + channel != NULL; + channel = ISC_LIST_NEXT(channel, link)) + if (channel->type == ISC_LOG_TOFILE && + (channel->flags & ISC_LOG_DEBUGONLY) != 0 && + FILE_STREAM(channel) != NULL) { + (void)fclose(FILE_STREAM(channel)); + FILE_STREAM(channel) = NULL; + } } unsigned int