Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!convex!convex.COM From: tchrist@convex.COM (Tom Christiansen) Newsgroups: comp.unix.wizards Subject: Re: syslog + chroot + ftpd Message-ID: <104489@convex.convex.com> Date: 31 Jul 90 15:49:35 GMT References: <1990Jul29.202447.11548@athena.mit.edu> <11477:Jul3018:50:4290@kramden.acf.nyu.edu> Sender: news@convex.com Reply-To: tchrist@convex.COM (Tom Christiansen) Distribution: usa Organization: CONVEX Software Development, Richardson, TX Lines: 55 In article <11477:Jul3018:50:4290@kramden.acf.nyu.edu> brnstnd@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@convex.COM "EMACS belongs in : Editor too big!"