log.c revision 8f7cae3d7b0c122c3b17e8409bbb80005433acd2
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * Copyright (C) 1999, 2000 Internet Software Consortium.
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * Permission to use, copy, modify, and distribute this software for any
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * purpose with or without fee is hereby granted, provided that the above
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * copyright notice and this permission notice appear in all copies.
bb2d54f1b3654857b8cb0209612ed847afbd9d3cMichael Graff * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
53f0234c3e3a845245042affb1f20a189d8791b9Automatic Updater * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
9c3531d72aeaad6c5f01efe6a1c82023e1379e4dDavid Lawrence * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
bb2d54f1b3654857b8cb0209612ed847afbd9d3cMichael Graff * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
bb2d54f1b3654857b8cb0209612ed847afbd9d3cMichael Graff * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
bb2d54f1b3654857b8cb0209612ed847afbd9d3cMichael Graff * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
bb2d54f1b3654857b8cb0209612ed847afbd9d3cMichael Graff * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
bb2d54f1b3654857b8cb0209612ed847afbd9d3cMichael Graff/* $Id: log.c,v 1.23 2000/08/25 01:08:19 bwelling Exp $ */
bb2d54f1b3654857b8cb0209612ed847afbd9d3cMichael Graff * When adding a new category, be sure to add the appropriate
bb2d54f1b3654857b8cb0209612ed847afbd9d3cMichael Graff * #define to <named/log.h>.
c40906dfad6dd6e3a3e3c94b8c8847bc9bc064e5Mark Andrews { "client", 0 },
c40906dfad6dd6e3a3e3c94b8c8847bc9bc064e5Mark Andrews { "network", 0 },
bb2d54f1b3654857b8cb0209612ed847afbd9d3cMichael Graff { "update", 0 },
ba751492fcc4f161a18b983d4f018a1a52938cb9Evan Hunt * When adding a new module, be sure to add the appropriate
ba751492fcc4f161a18b983d4f018a1a52938cb9Evan Hunt * #define to <dns/log.h>.
ba751492fcc4f161a18b983d4f018a1a52938cb9Evan Hunt { "main", 0 },
ba751492fcc4f161a18b983d4f018a1a52938cb9Evan Hunt { "client", 0 },
bb2d54f1b3654857b8cb0209612ed847afbd9d3cMichael Graff { "server", 0 },
bb2d54f1b3654857b8cb0209612ed847afbd9d3cMichael Graff { "query", 0 },
c1d7e0562f6a72ecc07ab5140cf2b88183adbd08Francis Dupont { "interfacemgr", 0 },
22bed621ef87bc8b6c1fea599b02c4b38dd6bf48Mark Andrews { "update", 0 },
76af83c9adb772f7b045c62cf8b411165bfaa5efMark Andrews { "xfer-in", 0 },
76af83c9adb772f7b045c62cf8b411165bfaa5efMark Andrews { "xfer-out", 0 },
76af83c9adb772f7b045c62cf8b411165bfaa5efMark Andrews { "notify", 0 },
76af83c9adb772f7b045c62cf8b411165bfaa5efMark Andrews { "omapi", 0 },
c1d7e0562f6a72ecc07ab5140cf2b88183adbd08Francis Dupont { "lwresd", 0 },
c1d7e0562f6a72ecc07ab5140cf2b88183adbd08Francis Dupont * Setup a logging context.
8e73941f33fad57111142a62d99717abc001912eMark Andrews result = isc_log_create(ns_g_mctx, &ns_g_lctx, &lcfg);
fc63119c8b7aa8827fad9e3e45e50c69bc2630e8Francis Dupont isc_log_registercategories(ns_g_lctx, ns_g_categories);
c1d7e0562f6a72ecc07ab5140cf2b88183adbd08Francis Dupont isc_log_registermodules(ns_g_lctx, ns_g_modules);
ba751492fcc4f161a18b983d4f018a1a52938cb9Evan Hunt * By default, the logging library makes "default_debug" log to
ba751492fcc4f161a18b983d4f018a1a52938cb9Evan Hunt * stderr. In BIND, we want to override this and log to named.run
ba751492fcc4f161a18b983d4f018a1a52938cb9Evan Hunt * instead, unless the the -g option was given.
ba751492fcc4f161a18b983d4f018a1a52938cb9Evan Hunt result = isc_log_createchannel(lcfg, "default_debug",
ba751492fcc4f161a18b983d4f018a1a52938cb9Evan Hunt * Set the initial debug level.
ba751492fcc4f161a18b983d4f018a1a52938cb9Evan Hunt isc_log_setdebuglevel(ns_g_lctx, ns_g_debuglevel);
bb2d54f1b3654857b8cb0209612ed847afbd9d3cMichael Graffns_log_setsafechannels(isc_logconfig_t *lcfg) {
bb2d54f1b3654857b8cb0209612ed847afbd9d3cMichael Graff result = isc_log_createchannel(lcfg, "default_debug",
bb2d54f1b3654857b8cb0209612ed847afbd9d3cMichael Graff * Setting the debug level to zero should get the output
bb2d54f1b3654857b8cb0209612ed847afbd9d3cMichael Graff * discarded a bit faster.
bb2d54f1b3654857b8cb0209612ed847afbd9d3cMichael Graffns_log_setdefaultcategory(isc_logconfig_t *lcfg) {
bb2d54f1b3654857b8cb0209612ed847afbd9d3cMichael Graff result = isc_log_usechannel(lcfg, "default_syslog",
bb2d54f1b3654857b8cb0209612ed847afbd9d3cMichael Graff result = isc_log_usechannel(lcfg, "default_debug",