SYSLOG(3C) COMMAND REFERENCE SYSLOG(3C)
NAME
syslog, openlog, closelog - control system log
SYNOPSIS
#include <syslog.h>
openlog(ident, logstat)
char *ident;
syslog(priority, message, parameters ... )
char *message;
closelog()
DESCRIPTION
Syslog arranges to write the message onto the system log
maintained by syslog(8). The message is tagged with
priority. The message looks like a printf(3) string except
that %m is replaced by the current error message (collected
from errno). A trailing newline is added if needed. This
message will be read by syslog(8) and output to the system
console or files as appropriate.
If special processing is needed, openlog can be called to
initialize the log file. Parameters are ident which is
prepended to every message, and logstat which is a bit field
indicating special status; current values are:
LOG_PID log the process ID with each message: useful for
identifying instances of daemons.
Openlog returns zero (0) on success. If it cannot open the
file /dev/log, it writes on /dev/console instead and returns
-1.
Closelog can be used to close the log file.
EXAMPLES
syslog(LOG_SALERT, "who: internal error 23");
openlog("serverftp", LOG_PID);
syslog(LOG_INFO, "Connection from host %d", CallingHost);
CAVEATS
If you elect to have your messages sent to the standard
system log as specified in the configuration file (see
syslog(8)) and the daemon, /etc/syslog is not running, your
program will be sent a SIGPIPE (see sigvec(2)) on the second
call to syslog.
Printed 3/13/89 1
%%index%%
na:312,98;
sy:410,1369;
de:1779,1561;
ex:3340,257;
ca:3597,459;
%%index%%000000000097