+3832. [func] "named -L <filename>" causes named to send log
+ messages to the specified file by default instead
+ of to the system log. (Thanks to Tony Finch.)
+ [RT #35845]
+
3831. [cleanup] Reduce logging noise when EDNS state changes occur.
[RT #35843]
the serial number will be set to the current date in YYYYMMDDNN
format.
- "dnssec-signzone -N date" sets the serial number to YYYYMMDDNN.
+ - "named -L <filename>" causes named to send log messages to
+ the specified file by default instead of to the system log.
BIND 9.10.0
EXTERN isc_boolean_t ns_g_foreground INIT(ISC_FALSE);
EXTERN isc_boolean_t ns_g_logstderr INIT(ISC_FALSE);
EXTERN isc_boolean_t ns_g_nosyslog INIT(ISC_FALSE);
+EXTERN const char * ns_g_logfile INIT(NULL);
EXTERN const char * ns_g_defaultsessionkeyfile
INIT(NS_LOCALSTATEDIR "/run/named/"
goto cleanup;
}
+ if (ns_g_logfile != NULL) {
+ destination.file.stream = NULL;
+ destination.file.name = ns_g_logfile;
+ destination.file.versions = ISC_LOG_ROLLNEVER;
+ destination.file.maximum_size = 0;
+ result = isc_log_createchannel(lcfg, "default_logfile",
+ ISC_LOG_TOFILE,
+ ISC_LOG_DYNAMIC,
+ &destination,
+ ISC_LOG_PRINTTIME|
+ ISC_LOG_PRINTCATEGORY|
+ ISC_LOG_PRINTLEVEL);
+ if (result != ISC_R_SUCCESS)
+ goto cleanup;
+ }
+
#if ISC_FACILITY != LOG_DAEMON
destination.facility = ISC_FACILITY;
result = isc_log_createchannel(lcfg, "default_syslog",
isc_result_t
ns_log_setsafechannels(isc_logconfig_t *lcfg) {
isc_result_t result;
-#if ISC_FACILITY != LOG_DAEMON
isc_logdestination_t destination;
-#endif
if (! ns_g_logstderr) {
result = isc_log_createchannel(lcfg, "default_debug",
isc_log_setdebuglevel(ns_g_lctx, ns_g_debuglevel);
}
+ if (ns_g_logfile != NULL) {
+ destination.file.stream = NULL;
+ destination.file.name = ns_g_logfile;
+ destination.file.versions = ISC_LOG_ROLLNEVER;
+ destination.file.maximum_size = 0;
+ result = isc_log_createchannel(lcfg, "default_logfile",
+ ISC_LOG_TOFILE,
+ ISC_LOG_DYNAMIC,
+ &destination,
+ ISC_LOG_PRINTTIME|
+ ISC_LOG_PRINTCATEGORY|
+ ISC_LOG_PRINTLEVEL);
+ if (result != ISC_R_SUCCESS)
+ goto cleanup;
+ }
+
#if ISC_FACILITY != LOG_DAEMON
destination.facility = ISC_FACILITY;
result = isc_log_createchannel(lcfg, "default_syslog",
isc_result_t
ns_log_setdefaultcategory(isc_logconfig_t *lcfg) {
- isc_result_t result;
-
- if (! ns_g_logstderr && ! ns_g_nosyslog) {
- result = isc_log_usechannel(lcfg, "default_syslog",
- ISC_LOGCATEGORY_DEFAULT, NULL);
- if (result != ISC_R_SUCCESS)
- goto cleanup;
- }
+ isc_result_t result = ISC_R_SUCCESS;
result = isc_log_usechannel(lcfg, "default_debug",
ISC_LOGCATEGORY_DEFAULT, NULL);
if (result != ISC_R_SUCCESS)
goto cleanup;
- result = ISC_R_SUCCESS;
+ if (! ns_g_logstderr) {
+ if (ns_g_logfile != NULL)
+ result = isc_log_usechannel(lcfg, "default_logfile",
+ ISC_LOGCATEGORY_DEFAULT,
+ NULL);
+ else if (! ns_g_nosyslog)
+ result = isc_log_usechannel(lcfg, "default_syslog",
+ ISC_LOGCATEGORY_DEFAULT,
+ NULL);
+ }
cleanup:
return (result);
save_command_line(argc, argv);
/* PLEASE keep options synchronized when main is hooked! */
-#define CMDLINE_FLAGS "46c:C:d:D:E:fFgi:lm:n:N:p:P:sS:t:T:U:u:vVx:"
+#define CMDLINE_FLAGS "46c:C:d:D:E:fFgi:lL:m:n:N:p:P:sS:t:T:U:u:vVx:"
isc_commandline_errprint = ISC_FALSE;
while ((ch = isc_commandline_parse(argc, argv, CMDLINE_FLAGS)) != -1) {
switch (ch) {
case 'l':
ns_g_lwresdonly = ISC_TRUE;
break;
+ case 'L':
+ ns_g_logfile = isc_commandline_argument;
+ break;
case 'm':
set_flags(isc_commandline_argument, mem_debug_flags,
&isc_mem_debugging);
<arg><option>-E <replaceable class="parameter">engine-name</replaceable></option></arg>
<arg><option>-f</option></arg>
<arg><option>-g</option></arg>
+ <arg><option>-L <replaceable class="parameter">logfile</replaceable></option></arg>
<arg><option>-m <replaceable class="parameter">flag</replaceable></option></arg>
<arg><option>-n <replaceable class="parameter">#cpus</replaceable></option></arg>
<arg><option>-p <replaceable class="parameter">port</replaceable></option></arg>
</listitem>
</varlistentry>
+ <varlistentry>
+ <term>-L <replaceable class="parameter">logfile</replaceable></term>
+ <listitem>
+ <para>
+ Log to the file <option>logfile</option> by default
+ instead of the system log.
+ </para>
+ </listitem>
+ </varlistentry>
+
<varlistentry>
<term>-m <replaceable class="parameter">flag</replaceable></term>
<listitem>
rm -f ns1/named_log ns1/named_pipe ns1/named_sym
rm -f ns1/named.conf
rm -rf ns1/named_dir
+rm -f ns1/named_deflog
--- /dev/null
+/*
+ * Copyright (C) 2014 Internet Systems Consortium, Inc. ("ISC")
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+options {
+ query-source address 10.53.0.1;
+ notify-source 10.53.0.1;
+ transfer-source 10.53.0.1;
+ port 5300;
+ pid-file "named.pid";
+ listen-on port 5300 {
+ 10.53.0.1;
+ };
+ listen-on-v6 { none; };
+ recursion no;
+ notify yes;
+};
+
+controls {
+ inet 127.0.0.1 port 9593 allow {
+ 127.0.0.1/32; ::1/128; }
+ keys { "rndc-key"; };
+};
+
+key "rndc-key" {
+ algorithm hmac-sha256;
+ secret "Am9vCg==";
+};
+
+zone "." {
+ type master;
+ file "root.db";
+};
DIRCONF="${THISDIR}/${CONFDIR}/named.dirconf"
PIPECONF="${THISDIR}/${CONFDIR}/named.pipeconf"
SYMCONF="${THISDIR}/${CONFDIR}/named.symconf"
+PLAINCONF="${THISDIR}/${CONFDIR}/named.plainconf"
PLAINFILE="named_log"
DIRFILE="named_dir"
PIPEFILE="named_pipe"
SYMFILE="named_sym"
+DLFILE="named_deflog"
PIDFILE="${THISDIR}/${CONFDIR}/named.pid"
myRNDC="$RNDC -c ${THISDIR}/${CONFDIR}/rndc.conf"
myNAMED="$NAMED -c ${THISDIR}/${CONFDIR}/named.conf -m record,size,mctx -T clienttest -T nosyslog -d 99 -U 4"
echo "I: skipping symlink test (unable to create symlink)"
fi
+status=0
+
+# Now stop the server again and test the -L option
+rm -f $DLFILE
+$myRNDC stop
+cp $PLAINCONF named.conf
+$myNAMED -L $DLFILE > /dev/null 2>&1
+if [ $? -ne 0 ]; then
+ echo "I:failed to start $myNAMED"
+ echo "I:exit status: $status"
+ exit $status
+fi
+
+sleep 1
+if [ -f "$DLFILE" ]; then
+ echo "I: testing default logfile using named -L succeeded"
+else
+ echo "I:testing default logfile using named -L failed"
+ echo "I:exit status: 1"
+ exit 1
+fi
+
echo "I:exit status: $status"
exit $status