supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
* isc dhcpd won't log to stdout/stderr
@ 2005-12-08  6:52 Dean Hall
  2005-12-08 19:04 ` Charlie Brady
  0 siblings, 1 reply; 2+ messages in thread
From: Dean Hall @ 2005-12-08  6:52 UTC (permalink / raw)


Hey all,

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?

My resulting command line as reported by `ps aux` is:

dhcpd -d -f -q -user dhcp -group dhcp eth0

--
Dean Hall
http://deanpence.com

The Cornhole Show
http://thecornholeshow.com




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: isc dhcpd won't log to stdout/stderr
  2005-12-08  6:52 isc dhcpd won't log to stdout/stderr Dean Hall
@ 2005-12-08 19:04 ` Charlie Brady
  0 siblings, 0 replies; 2+ messages in thread
From: Charlie Brady @ 2005-12-08 19:04 UTC (permalink / raw)
  Cc: supervision


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.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-12-08 19:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-08  6:52 isc dhcpd won't log to stdout/stderr Dean Hall
2005-12-08 19:04 ` Charlie Brady

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).