8a99b24dbe8e0e713f226f4696bfa215b38ad3c6Tinderbox User * Copyright (C) 1999-2002, 2004-2007, 2009, 2013, 2014, 2016, 2017 Internet Systems Consortium, Inc. ("ISC")
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * This Source Code Form is subject to the terms of the Mozilla Public
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * License, v. 2.0. If a copy of the MPL was not distributed with this
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * file, You can obtain one at http://mozilla.org/MPL/2.0/.
609f86163a9e80aa5ce0db79b67ee0b6e2a34b34Tatuya JINMEI 神明達哉/* $Id: log.c,v 1.49 2009/01/07 01:46:40 jinmei Exp $ */
1687985cdfc3a4c330c5bdb02c131835f8756e3cBob Halley * When adding a new category, be sure to add the appropriate
29747dfe5e073a299b3681e01f5c55540f8bfed7Mark Andrews * \#define to <named/log.h> and to update the list in
1687985cdfc3a4c330c5bdb02c131835f8756e3cBob Halley { "client", 0 },
1687985cdfc3a4c330c5bdb02c131835f8756e3cBob Halley { "network", 0 },
8327c62a49a2487d29a37acbed6b602e629fc0eeAndreas Gustafsson { "update", 0 },
86a4d80e0624a10b1824d25018246e1ea63f55d2Andreas Gustafsson { "queries", 0 },
89d03d4715120fd0c968775bf0724b5a2a647539Mark Andrews { "unmatched", 0 },
cc4928ec7116a064223f60639ca1a80f25ba350fMark Andrews { "update-security", 0 },
609f86163a9e80aa5ce0db79b67ee0b6e2a34b34Tatuya JINMEI 神明達哉 { "query-errors", 0 },
1c8aa38b53a0494fc7d4c3439594d1913987f264Mark Andrews { "trust-anchor-telementry", 0 },
1687985cdfc3a4c330c5bdb02c131835f8756e3cBob Halley * When adding a new module, be sure to add the appropriate
29747dfe5e073a299b3681e01f5c55540f8bfed7Mark Andrews * \#define to <dns/log.h>.
1687985cdfc3a4c330c5bdb02c131835f8756e3cBob Halley { "main", 0 },
1687985cdfc3a4c330c5bdb02c131835f8756e3cBob Halley { "client", 0 },
1687985cdfc3a4c330c5bdb02c131835f8756e3cBob Halley { "server", 0 },
1687985cdfc3a4c330c5bdb02c131835f8756e3cBob Halley { "query", 0 },
1687985cdfc3a4c330c5bdb02c131835f8756e3cBob Halley { "interfacemgr", 0 },
8327c62a49a2487d29a37acbed6b602e629fc0eeAndreas Gustafsson { "update", 0 },
8327c62a49a2487d29a37acbed6b602e629fc0eeAndreas Gustafsson { "xfer-in", 0 },
8327c62a49a2487d29a37acbed6b602e629fc0eeAndreas Gustafsson { "xfer-out", 0 },
608f870f4821972313eadc5388a42fa55b6279d1Mark Andrews { "notify", 0 },
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellington { "control", 0 },
878d3073b13833ee1a50dfeabf8e400b6fdfc754Brian Wellington { "lwresd", 0 },
8582a1e113c13886ccbd1b534d6c240315767be6Bob Halley * Setup a logging context.
edcd1247ad7e81bb8b430e610d9718f64c70f05dDavid Lawrence result = isc_log_create(ns_g_mctx, &ns_g_lctx, &lcfg);
c55dd77de4ce71b858afb291e44577b51be8b780Mark Andrews * named-checktool.c:setup_logging() needs to be kept in sync.
edcd1247ad7e81bb8b430e610d9718f64c70f05dDavid Lawrence isc_log_registercategories(ns_g_lctx, ns_g_categories);
1687985cdfc3a4c330c5bdb02c131835f8756e3cBob Halley isc_log_registermodules(ns_g_lctx, ns_g_modules);
7193a1762e428cfba06907e51fa9e4bce3b5569aAndreas Gustafsson result = ns_log_setdefaultchannels(lcfg);
a0f6cda5fd9f2fcc4154bb63628f849b639a40caAndreas Gustafsson result = ns_log_setdefaultcategory(lcfg);
a0f6cda5fd9f2fcc4154bb63628f849b639a40caAndreas Gustafssonns_log_setdefaultchannels(isc_logconfig_t *lcfg) {
11d435aa4cf77e035445978f7e3776a3589715fdAndreas Gustafsson * By default, the logging library makes "default_debug" log to
11d435aa4cf77e035445978f7e3776a3589715fdAndreas Gustafsson * stderr. In BIND, we want to override this and log to named.run
3fb1637c9265cc593973326ae193783413f68699Tatuya JINMEI 神明達哉 * instead, unless the -g option was given.
44fee668021c7ceef4ee1c848031d883a508b359James Brister destination.file.versions = ISC_LOG_ROLLNEVER;
11d435aa4cf77e035445978f7e3776a3589715fdAndreas Gustafsson result = isc_log_createchannel(lcfg, "default_debug",
44613d4d868ed5e73a1132280880f0699af56733Evan Hunt result = isc_log_createchannel(lcfg, "default_logfile",
ee80f4506479e189ca1320eb87ac89188c5a7848Mark Andrews result = isc_log_createchannel(lcfg, "default_syslog",
a0f6cda5fd9f2fcc4154bb63628f849b639a40caAndreas Gustafsson * Set the initial debug level.
a0f6cda5fd9f2fcc4154bb63628f849b639a40caAndreas Gustafsson isc_log_setdebuglevel(ns_g_lctx, ns_g_debuglevel);
7193a1762e428cfba06907e51fa9e4bce3b5569aAndreas Gustafssonns_log_setsafechannels(isc_logconfig_t *lcfg) {
7193a1762e428cfba06907e51fa9e4bce3b5569aAndreas Gustafsson result = isc_log_createchannel(lcfg, "default_debug",
1d9ab721315555ac75e7d4f57585323909283688Andreas Gustafsson * Setting the debug level to zero should get the output
1d9ab721315555ac75e7d4f57585323909283688Andreas Gustafsson * discarded a bit faster.
1d9ab721315555ac75e7d4f57585323909283688Andreas Gustafsson isc_log_setdebuglevel(ns_g_lctx, ns_g_debuglevel);
44613d4d868ed5e73a1132280880f0699af56733Evan Hunt result = isc_log_createchannel(lcfg, "default_logfile",
3b4405aba93729eead9f8f006d426f24fc4c3d78Mark Andrews result = isc_log_createchannel(lcfg, "default_syslog",
a0f6cda5fd9f2fcc4154bb63628f849b639a40caAndreas Gustafssonns_log_setdefaultcategory(isc_logconfig_t *lcfg) {
5542df09597c479be604da0ece8271cbc6fd9c4aDavid Lawrence result = isc_log_usechannel(lcfg, "default_debug",
44613d4d868ed5e73a1132280880f0699af56733Evan Hunt result = isc_log_usechannel(lcfg, "default_logfile",
44613d4d868ed5e73a1132280880f0699af56733Evan Hunt result = isc_log_usechannel(lcfg, "default_syslog",