mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-03 08:05:21 +00:00
direct logging to stderr iff the '-f' option is doubled
This commit is contained in:
@@ -75,6 +75,7 @@ EXTERN const char * ns_g_conffile INIT(NS_SYSCONFDIR
|
|||||||
EXTERN isc_boolean_t ns_g_coreok INIT(ISC_TRUE);
|
EXTERN isc_boolean_t ns_g_coreok INIT(ISC_TRUE);
|
||||||
EXTERN const char * ns_g_chrootdir INIT(NULL);
|
EXTERN const char * ns_g_chrootdir INIT(NULL);
|
||||||
EXTERN isc_boolean_t ns_g_foreground INIT(ISC_FALSE);
|
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
|
EXTERN char * ns_g_defaultpidfile INIT(NS_LOCALSTATEDIR
|
||||||
"/run/named.pid");
|
"/run/named.pid");
|
||||||
|
@@ -87,7 +87,7 @@ ns_log_init(void) {
|
|||||||
/*
|
/*
|
||||||
* Create and install the default channel.
|
* Create and install the default channel.
|
||||||
*/
|
*/
|
||||||
if (ns_g_foreground) {
|
if (ns_g_logstderr) {
|
||||||
destination.file.stream = stderr;
|
destination.file.stream = stderr;
|
||||||
destination.file.name = NULL;
|
destination.file.name = NULL;
|
||||||
destination.file.versions = ISC_LOG_ROLLNEVER;
|
destination.file.versions = ISC_LOG_ROLLNEVER;
|
||||||
|
@@ -163,7 +163,7 @@ library_unexpected_error(char *file, int line, char *format, va_list args) {
|
|||||||
static void
|
static void
|
||||||
usage(void) {
|
usage(void) {
|
||||||
fprintf(stderr,
|
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");
|
" [-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);
|
ns_g_debuglevel = atoi(isc_commandline_argument);
|
||||||
break;
|
break;
|
||||||
case 'f':
|
case 'f':
|
||||||
|
if (ns_g_foreground == ISC_TRUE)
|
||||||
|
ns_g_logstderr = ISC_TRUE;
|
||||||
ns_g_foreground = ISC_TRUE;
|
ns_g_foreground = ISC_TRUE;
|
||||||
break;
|
break;
|
||||||
case 'N':
|
case 'N':
|
||||||
|
@@ -929,7 +929,12 @@ load_configuration(const char *filename, ns_server_t *server,
|
|||||||
/*
|
/*
|
||||||
* Configure the logging system.
|
* 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;
|
dns_c_logginglist_t *clog = NULL;
|
||||||
isc_logconfig_t *logc = NULL;
|
isc_logconfig_t *logc = NULL;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user