From: Charlie Brady <charlieb-supervision@budge.apana.org.au>
Cc: supervision@list.skarnet.org
Subject: Re: isc dhcpd won't log to stdout/stderr
Date: Thu, 8 Dec 2005 14:04:09 -0500 (EST) [thread overview]
Message-ID: <Pine.LNX.4.61.0512081347580.24139@e-smith.charlieb.ott.istop.com> (raw)
In-Reply-To: <419BFB78-B212-4EDA-A19D-33CE6CA02BB6@gmail.com>
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.
<checks>
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.
prev parent reply other threads:[~2005-12-08 19:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-12-08 6:52 Dean Hall
2005-12-08 19:04 ` Charlie Brady [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.61.0512081347580.24139@e-smith.charlieb.ott.istop.com \
--to=charlieb-supervision@budge.apana.org.au \
--cc=supervision@list.skarnet.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).