Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

syslog(8)

syslog(3)

Name

syslog, openlog, closelog − control system log

Syntax

#include <syslog.h>

openlog(ident, logstat)
char *ident;

syslog(priority, message, parameters ... )
char *message;

closelog()

Description

The syslog subroutine arranges to write the message onto the system log maintained by syslog(.). The message is tagged with priority and it looks like a printf() string except that %m is replaced by the current error message (collected from errno). A trailing new line is added if needed. This message is read by syslog() and output to the system console or files as appropriate. The maximum number of parameters is 5.

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 daemons.

The openlog returns zero on success. If it cannot open the file /dev/log, it writes on /dev/console instead and returns −1.

The 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);

See Also

syslog(8)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026