syslog.3c (2010 09)

s
syslog(3C) syslog(3C)
EXAMPLES
who logs a message regarding some sort of unexpected and serious error:
syslog(LOG_ALERT, "who: internal error 23");
ftpd uses openlog() to arrange to log its process ID, to log to the console if necessary, and to log in
the name of the daemon facility:
openlog("ftpd", LOG_PID|LOG_CONS, LOG_DAEMON);
Arrange to log messages only at levels LOG_ERR
and lower:
setlogmask(LOG_UPTO(LOG_ERR));
Typical usage of
syslog() to log a connection:
syslog(LOG_INFO, "Connection from host %s", CallingHost);
If the facility has not been set with
openlog(), it defaults to LOG_USER.
Explicitly set the facility for this message:
syslog(LOG_INFO|LOG_LOCAL2, "foobar error: %m");
WARNINGS
A call to syslog() has no effect unless the syslog daemon is running (see syslogd (1M)).
openlog()
does not copy and store the ident string internally; it stores only a character pointer. Therefore it is the
responsibility of the programmer to make sure that the ident argument points to the correct string until
the log file is closed.
AUTHOR
syslog() was developed by the University of California, Berkeley.
SEE ALSO
logger(1), syslogd(1M), thread_safety(5).
HP-UX 11i Version 3: September 2010 3 Hewlett-Packard Company 3