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

Erik Auerswald auerswal at unix-ag.uni-kl.de
Tue Jan 29 11:18:37 MST 2008


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

Erik



More information about the Nas mailing list