Return values of the syslog(3) family

Mike Meyer mwm-dated-1050336848.0c448f at
Wed Apr 9 09:14:11 PDT 2003

In <1049840007.685.79.camel at>, Christopher Nehren <apeiron at> typed:
> I've looked at the prototypes of various BSD and Linux systems'
> syslog(3) calls, and they all have 'void' as the return type. Now,
> logically, since a log file is being written, wouldn't it be nice to
> know whether that call executed successfully? Yes, I've already thought
> of the "If you can't write to syslog, then you have larger problems than
> this" ... but how would one -know- they have these problems? I admit
> that I'm probably missing something about the Nature of Programming; but
> at least to this newbie, it seems like it defeats part of the point of
> calling the functions in the first place. TIA for any information about
> this.

Just out of curiosity, exactly what do you expect a program that has
just found out that it's logging facility to do? You obviously can't
log the fact - though I've seen systems that tried. You don't want to
exit without notifying someone of the fact, and the facility you'd
most likely use to do that is no longer functioning. You might quit
logging and queue the messages to log later, but then you'd have to
try logging the first one and see if it works. Besides, that would put
false timestamps on each message. If many daemons did this, you'd risk
running the system out of virtual, which is a bad idea. All in all,
I'd say the best thing to do after a failing syslog is ignore it.

Mike Meyer <mwm at>
Independent Network/Unix/Perforce consultant, email for more information.

More information about the freebsd-questions mailing list