From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.sysutils.supervision.general/938 Path: news.gmane.org!not-for-mail From: Charlie Brady Newsgroups: gmane.comp.sysutils.supervision.general Subject: Re: isc dhcpd won't log to stdout/stderr Date: Thu, 8 Dec 2005 14:04:09 -0500 (EST) Message-ID: References: <419BFB78-B212-4EDA-A19D-33CE6CA02BB6@gmail.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Trace: sea.gmane.org 1134068862 25281 80.91.229.2 (8 Dec 2005 19:07:42 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 8 Dec 2005 19:07:42 +0000 (UTC) Cc: supervision@list.skarnet.org Original-X-From: supervision-return-1174-gcsg-supervision=m.gmane.org@list.skarnet.org Thu Dec 08 20:07:40 2005 Return-path: Original-Received: from antah.skarnet.org ([212.85.147.14]) by ciao.gmane.org with smtp (Exim 4.43) id 1EkR3u-0004Ih-Dw for gcsg-supervision@gmane.org; Thu, 08 Dec 2005 20:04:14 +0100 Original-Received: (qmail 15718 invoked by uid 76); 8 Dec 2005 19:04:35 -0000 Mailing-List: contact supervision-help@list.skarnet.org; run by ezmlm List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Archive: Original-Received: (qmail 15712 invoked from network); 8 Dec 2005 19:04:34 -0000 X-X-Sender: charlieb@e-smith.charlieb.ott.istop.com Original-To: Dean Hall In-Reply-To: <419BFB78-B212-4EDA-A19D-33CE6CA02BB6@gmail.com> Xref: news.gmane.org gmane.comp.sysutils.supervision.general:938 Archived-At: On Thu, 8 Dec 2005, Dean Hall wrote: > I'm trying to get dhcpd (3.0.1) supervised by runsv on Gentoo Linux, and > though dhcpd's man page says that it will log to STDERR with the "-d" flag, > and though I'm using that flag when I run it, all logs still go straight to > syslog. I even commented the "log-facility" directive in dhcpd.conf just in > case. Has anyone got this version to log to STDERR successfully? I see the same as you. Looks like a bug in dhcpd to me. OK, here's the story. Don't use "-d -q", just use "-d". That'll get you stderr logging, but as well as syslog, not instead of. If you don't want syslog, compile with -DDEBUG (although that might make other changes you don't want - I haven't checked what else it does). Here's log_info(). As you can see, it logs to syslog and then to stderr iff log_perror is non-zero: omapip/errwarn.c int log_info (const char *fmt, ...) { va_list list; do_percentm (fbuf, fmt); /* %Audit% This is log output. %2004.06.17,Safe% * If we truncate we hope the user can get a hint from the log. */ va_start (list, fmt); vsnprintf (mbuf, sizeof mbuf, fbuf, list); va_end (list); #ifndef DEBUG syslog (log_priority | LOG_INFO, "%s", mbuf); #endif if (log_perror) { write (2, mbuf, strlen (mbuf)); write (2, "\n", 1); } return 0; } server/dhcpd.c: ... } else if (!strcmp (argv [i], "-f")) { #ifndef DEBUG daemon = 0; #endif } else if (!strcmp (argv [i], "-d")) { #ifndef DEBUG daemon = 0; #endif log_perror = -1; } else if (!strcmp (argv [i], "-s")) { ... } else if (!strcmp (argv [i], "-q")) { quiet = 1; quiet_interface_discovery = 1; } else if (!strcmp (argv [i], "--version")) { ... if (!quiet) { log_info ("%s %s", message, DHCP_VERSION); log_info (copyright); log_info (arr); log_info (url); } else { quiet = 0; log_perror = 0; } ... /* If we were requested to log to stdout on the command line, keep doing so; otherwise, stop. */ if (log_perror == -1) log_perror = 1; else log_perror = 0; ... So, -q clobbers the effect of -d on logging. And -f isn't needed if you use -d. So just use -d, and put up with logging to syslog, or compile with -DDEBUG, or patch the code.