[nas] [RFC] send debug output to syslog as well

Jon Trulson jon at radscan.com
Tue Jan 29 18:22:55 MST 2008


On Tue, 29 Jan 2008, Erik Auerswald wrote:

> Hi,
>
> it can be useful to send debugging output to syslog as well as to
> stderr. For example when trying to debug an intermittent problem with a
> most of the time working nasd. The current code disables using syslog
> when the debug option is set.
>
> I would like something like this patch:
>
> Index: server/os/aulog.c
> ===================================================================
> --- server/os/aulog.c	(revision 271)
> +++ server/os/aulog.c	(working copy)
> @@ -35,17 +35,16 @@
>
> #if defined(DIA_USE_SYSLOG)
>
> -    if (NasConfig.DoDebug) {    /* debugging to stderr if on */
> +    if (NasConfig.DoDebug) {    /* debugging to stderr as well if on */
>         errfd = stderr;
>         if (errfd != NULL) {
>             fprintf(errfd, "%s", buf);
>             fflush(errfd);
>         }
> -    } else {
> -        openlog("nas", LOG_PID, LOG_DAEMON);
> -        syslog(LOG_DEBUG, buf);
> -        closelog();
>     }
> +    openlog("nas", LOG_PID, LOG_DAEMON);
> +    syslog(LOG_DEBUG, buf);
> +    closelog();
>
> #else /* we just send to stdout */
>
> Setting the debug-level should help controlling the generated output.
>
> What do you think? Is there a need for _not_ sending the debug output to
> syslog? Do we need to separate debug output from normal output by
> introducing an osLogDebug() function, sending a LOG_DEBUG level message
> to syslog and writing the same message to stderr?
>

   I think I was just being lazy... When debugging, I like to run nasd
   w/ '-d XX' and have all the output go to stderr (I don't run it as a
   daemon in these cases).

   Your patch does this incidentally - it's ok by me.

> I don't like the current situation, but I don't want to change this
> without some feedback first. And I am definitely too lazy to implement
> the osLogDebug() solution without being convinced this is necessary. ;-)

   Would it make sense to have debugging go to stderr only if it's not
   running as a daemon?

>
> Erik
>

-- 
Happy cheese in fear                 | Jon Trulson
against oppressor, rebel!            | mailto:jon at radscan.com
Brocolli, hostage.       -Unknown    | #include <std/disclaimer.h>



More information about the Nas mailing list