syslog, openlog, closelog - control system log
void syslog(priority, message, parameters ... )
The subroutine arranges to write the message onto the system log main‐
tained by The message is tagged with priority and it looks like a
string except that %m is replaced by the current error message (col‐
lected from A trailing new line is added if needed. This message is
read by and output to the system console or files as appropriate. The
maximum number of parameters is 5.
If special processing is needed, 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
LOG_PID log the process id with each message; useful for identifying
The returns zero on success. If it cannot open the file it writes on
instead and returns -1.
The can be used to close the log file.
syslog(LOG_SALERT, "who: internal error 23");
syslog(LOG_INFO, "Connection from host %d", CallingHost);