log.c revision 7193a1762e428cfba06907e51fa9e4bce3b5569a
7d98a1783f222964bcde7d56dab77b822706204dBob Halley * Copyright (C) 1999, 2000 Internet Software Consortium.
1687985cdfc3a4c330c5bdb02c131835f8756e3cBob Halley * Permission to use, copy, modify, and distribute this software for any
1687985cdfc3a4c330c5bdb02c131835f8756e3cBob Halley * purpose with or without fee is hereby granted, provided that the above
1687985cdfc3a4c330c5bdb02c131835f8756e3cBob Halley * copyright notice and this permission notice appear in all copies.
1687985cdfc3a4c330c5bdb02c131835f8756e3cBob Halley * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
1687985cdfc3a4c330c5bdb02c131835f8756e3cBob Halley * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
1687985cdfc3a4c330c5bdb02c131835f8756e3cBob Halley * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
1687985cdfc3a4c330c5bdb02c131835f8756e3cBob Halley * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
1687985cdfc3a4c330c5bdb02c131835f8756e3cBob Halley * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
1687985cdfc3a4c330c5bdb02c131835f8756e3cBob Halley * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
1687985cdfc3a4c330c5bdb02c131835f8756e3cBob Halley * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
1687985cdfc3a4c330c5bdb02c131835f8756e3cBob Halley * When adding a new category, be sure to add the appropriate
1687985cdfc3a4c330c5bdb02c131835f8756e3cBob Halley * #define to <named/log.h>.
1687985cdfc3a4c330c5bdb02c131835f8756e3cBob Halley { "client", 0 },
1687985cdfc3a4c330c5bdb02c131835f8756e3cBob Halley { "network", 0 },
8327c62a49a2487d29a37acbed6b602e629fc0eeAndreas Gustafsson { "update", 0 },
1687985cdfc3a4c330c5bdb02c131835f8756e3cBob Halley * When adding a new module, be sure to add the appropriate
1687985cdfc3a4c330c5bdb02c131835f8756e3cBob Halley * #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 },
8582a1e113c13886ccbd1b534d6c240315767be6Bob Halley * Setup a logging context.
edcd1247ad7e81bb8b430e610d9718f64c70f05dDavid Lawrence result = isc_log_create(ns_g_mctx, &ns_g_lctx, &lcfg);
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
11d435aa4cf77e035445978f7e3776a3589715fdAndreas Gustafsson * instead, unless the the -g option was given.
44fee668021c7ceef4ee1c848031d883a508b359James Brister destination.file.versions = ISC_LOG_ROLLNEVER;
11d435aa4cf77e035445978f7e3776a3589715fdAndreas Gustafsson result = isc_log_createchannel(lcfg, "default_debug",
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",
7193a1762e428cfba06907e51fa9e4bce3b5569aAndreas Gustafsson * Setting the debug level to zero should get the output
7193a1762e428cfba06907e51fa9e4bce3b5569aAndreas Gustafsson * discarded a bit faster.
a0f6cda5fd9f2fcc4154bb63628f849b639a40caAndreas Gustafssonns_log_setdefaultcategory(isc_logconfig_t *lcfg) {
5542df09597c479be604da0ece8271cbc6fd9c4aDavid Lawrence result = isc_log_usechannel(lcfg, "default_syslog",
5542df09597c479be604da0ece8271cbc6fd9c4aDavid Lawrence result = isc_log_usechannel(lcfg, "default_debug",