2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 06:25:31 +00:00

direct logging to stderr iff the '-f' option is doubled

This commit is contained in:
Andreas Gustafsson
2000-02-28 22:17:59 +00:00
parent 21c39a1a83
commit f30f2b279c
4 changed files with 11 additions and 3 deletions

View File

@@ -75,6 +75,7 @@ EXTERN const char * ns_g_conffile INIT(NS_SYSCONFDIR
EXTERN isc_boolean_t ns_g_coreok INIT(ISC_TRUE);
EXTERN const char * ns_g_chrootdir INIT(NULL);
EXTERN isc_boolean_t ns_g_foreground INIT(ISC_FALSE);
EXTERN isc_boolean_t ns_g_logstderr INIT(ISC_FALSE);
EXTERN char * ns_g_defaultpidfile INIT(NS_LOCALSTATEDIR
"/run/named.pid");

View File

@@ -87,7 +87,7 @@ ns_log_init(void) {
/*
* Create and install the default channel.
*/
if (ns_g_foreground) {
if (ns_g_logstderr) {
destination.file.stream = stderr;
destination.file.name = NULL;
destination.file.versions = ISC_LOG_ROLLNEVER;

View File

@@ -163,7 +163,7 @@ library_unexpected_error(char *file, int line, char *format, va_list args) {
static void
usage(void) {
fprintf(stderr,
"usage: named [-c conffile] [-d debuglevel] [-f] [-N number_of_cpus]\n"
"usage: named [-c conffile] [-d debuglevel] [-f[f]] [-N number_of_cpus]\n"
" [-p port] [-s] [-t chrootdir] [-u username]\n");
}
@@ -184,6 +184,8 @@ parse_command_line(int argc, char *argv[]) {
ns_g_debuglevel = atoi(isc_commandline_argument);
break;
case 'f':
if (ns_g_foreground == ISC_TRUE)
ns_g_logstderr = ISC_TRUE;
ns_g_foreground = ISC_TRUE;
break;
case 'N':

View File

@@ -929,7 +929,12 @@ load_configuration(const char *filename, ns_server_t *server,
/*
* Configure the logging system.
*/
{
if (ns_g_logstderr) {
isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,
NS_LOGMODULE_SERVER, ISC_LOG_INFO,
"ignoring named.conf logging statement "
"due to -ff option");
} else {
dns_c_logginglist_t *clog = NULL;
isc_logconfig_t *logc = NULL;