gtpc2m59 | C/C++ Language Support User's Guide |
This function opens a connection to the logging facility and sets process
attributes that affect subsequent calls to the syslog
function. Use this function with the syslog function and the
closelog function to use the logging facilities provided with the
syslog daemon.
See TPF Transmission Control Protocol/Internet
Protocol for more information about the syslog daemon.
Format
#include <syslog.h>
void openlog(const char *ident, int logopt, int facility);
- ident
- A pointer to a string that is prefixed to every message or a NULL
pointer.
- logopt
- Specify the following value or NULL:
- LOG_PID
- Log the process ID with each message. This is useful for
identifying specific processes.
- facility
- Specifies a default facility to be assigned to all messages that do not
have an explicit facility already coded. If you specify NULL, the
initial default facility is LOG_USER. See syslog-Send a Message to the Control Log for more information about the other values that can be
specified.
Normal Return
Void.
Error Return
Not applicable.
Programming Considerations
- It is not necessary to call the openlog function before calling
the syslog function. If you do not call the
openlog function, the openlog function is called
automatically the first time the syslog function is called.
If you do not call the openlog function, messages will be logged
without a prefix and any message without an explicit facility will be logged
to the destination defined for the LOG_USER facility.
- This function is implemented in dynamic link library (DLL)
CTXO. You must use the definition side-deck for DLL CTXO to link-edit
an application that uses this function.
Examples
See syslog-Send a Message to the Control Log for an example using the openlog function.
Related Information