.TH SYSLOG 3 "14 November 1982" .\" @(#)syslog.3 1.2 11/14/82 .SH NAME syslog, openlog, closelog \- control system log .SH SYNOPSIS .B "#include .PP .B "openlog(ident, logstat) .br .B "char *ident; .PP .B "syslog(priority, message, parameters ... ) .br .B "char *message; .PP .B "closelog() .SH DESCRIPTION .I Syslog arranges to write the .I message onto the system log maintained by .IR syslog (8). The message is tagged with .IR priority . The message looks like a .IR printf (3) string except that .B %m is replaced by the current error message (collected from .IR errno ). A trailing newline is added if needed. This message will be read by .IR syslog (8) and output to the system console or files as appropriate. .PP If special processing is needed, .I openlog can be called to initialize the log file. Parameters are .I ident which is prepended to every message, and .I logstat which is a bit field indicating special status; current values are: .IP LOG_PID \w'LOG_PID'u+3 log the process id with each message: useful for identifying instantiations of daemons. .LP .I Openlog returns zero on success. If it cannot open the file .I /dev/log, it writes on .I /dev/console instead and returns \-1. .PP .I Closelog can be used to close the log file. .SH EXAMPLES .nf syslog(LOG_SALERT, "who: internal error 23"); openlog("serverftp", LOG_PID); syslog(LOG_INFO, "Connection from host %d", CallingHost); .fi .SH "SEE ALSO syslog(8)