syslog + chroot + ftpd

Tom Christiansen tchrist at convex.COM
Wed Aug 1 01:49:35 AEST 1990


In article <11477:Jul3018:50:4290 at kramden.acf.nyu.edu> brnstnd at kramden.acf.nyu.edu (Dan Bernstein) writes:
>In what conceivable way can syslog() do better than stderr? 

Syslogd(8) from BSD4.3 is a highly useful general purpose error
handling facility.  It solves numerous problems that crop up from 
ad hoc error logging.  See Eric Allmen's article in the C Advisor
column of UNIX REVIEW for the author's perspective.   Here are
the things that come immediately to my mind:

    * It allows the sysmgr to centrally control what kinds of error
      messages he's interested in, which can be configured to go to 
	  the console
	  files
	  biff sysadmins
	  be forwarded to master log hosts, 
	    which can in turn send to console, files, people, hosts

      These can be used separately or in conjunction (multiple
      destinations), and can be tuned/tweaked according to priority and
      facility class.

    * You don't have to constantly re-invent logging code.  You don't
      have to be careful about opens on the console blocking due to
      control-s or whatnot and hanging YOUR program.  You don't have to be
      careful about remembering to use O_APPEND.  Programmers tend to
      forget things like these.

    * The kernel, C programs, and scripts can all use the same logging facility.  
      This is really neat, although I wish the kernel wouldn't use the same priority 
      in all cases.  You can get at it through both the library interface syslog(3)
      and the script interface of logger(1).

    * You don't have to remember to properly redirect standard error when 
      you start or restart a daemon.  Too often /etc/rc lines just read
	    daemon > /dev/console & echo -n " daemon" > /dev/console
      which means you forgot stderr, plus you can't check it out from 
      your terminal, plus the output is lost except perhaps to hard copy.
      Starting them from your own terminal would have the same problems.


In summary, just writing to stderr is a practice fraught with the danger
of doing it wrong, does not permit easy and fine-grained configurability.
Syslog can be used by all forms of programs, encourages code sharing and a
common interface, and allows you to easily write summarization scripts.

Stderr writing is a bad practice that should shrivel up and die.

I guess this is why we need a comp.unix.admin newsgroup.

--tom
--

    Tom Christiansen                       {uunet,uiucdcs,sun}!convex!tchrist 
    Convex Computer Corporation                            tchrist at convex.COM
		 "EMACS belongs in <sys/errno.h>: Editor too big!"



More information about the Comp.unix.wizards mailing list