[Previous]
[Contents]
[Next]

openlog()

open the system log

Synopsis:

#include <syslog.h>
#include <stdargs.h>
void openlog( const char *ident, int logopt, 
              int facility)

Description:

The openlog() function opens the system log, and provides for more specialized processing of the messages sent by syslog() and vsyslog(). The parameter ident is a string that's prepended to every message. The logopt argument is a bit field specifying logging options, and is formed by combining one or more of the following values with an OR operation:

LOG_CONS
If syslog() can't pass the message to syslogd, it attempts to write the message to the /dev/console device. Note that /dev/console isn't a native QNX device-use the prefix command to point /dev/console to a read device or file (for example, prefix -A /dev/console=/dev/con1).
LOG_NDELAY
Open the connection to syslogd immediately. Normally the opening is delayed until the first message is logged.
LOG_PERROR
Write the message to standard error output as well to the system log.
LOG_PID
Log the process ID with each message. This is useful for identifying instantiations of daemons.

The facility parameter encodes a default facility to be assigned to all messages that don't have an explicit facility encoded. In the following list, parameter values marked with an asterisk (*) aren't used by QNX or the utility suite.

LOG_AUTH *
The authorization system (login, su, and so on).
LOG_AUTHPRIV *
The same as LOG_AUTH, but logged to a file readable only by selected individuals.
LOG_CRON *
The clock daemon.
LOG_DAEMON
System daemons (such as ftpd and, routed) that aren't provided for explicitly by other facilities.
LOG_KERN *
Messages generated by the kernel. These cant be generated by any user processes.
LOG_LOCAL0 ... LOG_LOCAL7 *
Reserved for local use.
LOG_LPR
The line printer spooling system (lp, lpc, and so on).
LOG_MAIL
The mail system.
LOG_NEWS *
The network news system.
LOG_SYSLOG
Messages generated internally by syslogd.
LOG_USER *
Messages generated by random user processes. This is the default facility identifier if none is specified.
LOG_UUCP *
The uucp system.

Examples:

See syslog().

Classification:

UNIX

Safety:
Interrupt handler No
Signal handler No
Thread Yes

See also:

closelog(), setlogmask(), syslog(), vsyslog()

logger, syslogd in the QNX Utilities Reference


[Previous]
[Contents]
[Next]