Node:openlog, Next:syslog; vsyslog, Up:Submitting Syslog Messages
The symbols referred to in this section are declared in the file
syslog.h
.
void openlog (char *ident, int option, | Function |
int facility)
openlog opens or reopens a connection to Syslog in preparation
for submitting messages.
ident is an arbitrary identification string which future
syslog invocations will prefix to each message. This is intended
to identify the source of the message, and people conventionally set it
to the name of the program that will submit the messages.
openlog may or may not open the /dev/log socket, depending
on option. If it does, it tries to open it and connect it as a
stream socket. If that doesn't work, it tries to open it and connect it
as a datagram socket. The socket has the "Close on Exec" attribute,
so the kernel will close it if the process performs an exec.
You don't have to use openlog . If you call syslog without
having called openlog , syslog just opens the connection
implicitly and uses defaults for the information in ident and
options.
options is a bit string, with the bits as defined by the following
single bit masks:
syslog on this connection that specifies default facility causes
this facility to be associated with the message. See syslog for
possible values. A value of zero means the default default, which is
LOG_USER .
If a Syslog connection is already open when you call openlog ,
openlog "reopens" the connection. Reopening is like opening
except that if you specify zero for the default facility code, the
default facility code simply remains unchanged and if you specify
LOG_NDELAY and the socket is already open and connected, openlog
just leaves it that way.
|