syslog()
QNX SDP8.0C Library ReferenceAPIDeveloper
Write a message to the slogger2 system log
Synopsis:
#include <syslog.h>
void syslog( int priority,
const char * message,
...)
Arguments:
- priority
- The priority of the message; see
Message levels,
below. - message
- The message that you want to write.
This 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 formatting characters that you use in the message determine any additional arguments.
Library:
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
Description:
The syslog() function writes message to the system message logger. (See the slogger2 command.)
The vsyslog() function is an alternate form in which the arguments have already been captured using the variable-length argument facilities of <stdarg.h>.
Message levels
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:
- LOG_KERN
- Kernel messages.
- LOG_USER
- Random user-level messages.
- LOG_MAIL
- Mail system.
- LOG_DAEMON
- System daemons.
- LOG_AUTH
- Security/authorization messages.
- LOG_LPR
- Line printer subsystem.
- LOG_NEWS
- Network news subsystem.
- LOG_UUCP
- UUCP subsystem.
- LOG_CRON
- Clock daemon.
- LOG_AUTHPRIV
- Security/authorization messages (private).
- LOG_FTP
- ftp daemon.
- LOG_LOCAL0 through LOG_LOCAL7
- Reserved for local use.
The level is selected from the following list (ordered from high to low):
- LOG_EMERG
- A panic condition. This is normally broadcast to all users.
- LOG_ALERT
- A condition that should be corrected immediately, such as a corrupted system database.
- LOG_CRIT
- Critical conditions (for example, hard device errors).
- LOG_ERR
- General errors.
- LOG_WARNING
- Warning messages.
- LOG_NOTICE
- Conditions that aren't error conditions, but should possibly be specially handled.
- LOG_INFO
- Informational messages.
- LOG_DEBUG
- Messages that contain information normally of use only when debugging a program.
Examples:
syslog(LOG_ALERT, "who: internal error 23");
openlog("Nfs", LOG_PID|LOG_PERROR, LOG_DAEMON);
setlogmask(LOG_UPTO(LOG_ERR));
syslog(LOG_INFO, "Opening file: %s", filename);
syslog(LOG_INFO|LOG_LOCAL2, "foobar error: %m");
Classification:
Safety: | |
---|---|
Cancellation point | Yes |
Signal handler | No |
Thread | Yes |
Page updated: