write a message to the system log
#include <syslog.h> void syslog(int priority, const char *message, ...)
The syslog() function writes message to the system message logger. The message is then written to the system console, log files, and logged-in users, or forwarded to other machines as appropriate. (See the syslogd command in the QNX Utilities Reference.)
The message is identical to a printf() format string, except that %m is replaced by the current error message (as denoted by the global variable errno). A trailing newline is added if none is present.
The vsyslog() function is an alternate form in which the arguments have already been captured using the variable-length argument facilities of varargs.
The message is tagged with priority. Priorities are encoded as a facility and a level. The facility describes the part of the system generating the message. The level is selected from the following list (ordered from high to low):
syslog(LOG_ALERT, "who: internal error 23"); openlog("ftpd", LOG_PID, LOG_DAEMON); setlogmask(LOG_UPTO(LOG_ERR)); syslog(LOG_INFO, "Connection from host %d", CallingHost); syslog(LOG_INFO|LOG_LOCAL2, "foobar error: %m");
The environment variable SYSLOG is used to indicate which QNX node to Send() log messages to. The default is to look just on the local node for the syslogd daemon.
UNIX
Safety: | |
---|---|
Interrupt handler | No |
Signal handler | No |
Thread | No |
closelog(), openlog(), setlogmask(), vsyslog()
logger, syslogd in the QNX Utilities Reference