Using syslogd for z/OS UNIX application programs

You can use the logging facilities of the syslogd server with your z/OS® UNIX application programs. Include the syslog.h header file with C programs so that they can open a log facility, send log messages to syslogd, and close the facility:
#include <syslog.h>
 
1 openlog("oec", LOG_PID, LOG_LOCAL0);
2 syslog(LOG_INFO, "Hello from oec");
3 closelog();

1 Open a log facility with the name of local0. Prefix each line in the log file with the program name (oec) and the process ID.

2 Log an info priority message with the specified content.

3 Close the log facility name.

The preceding statements created the following line in the log file:
May 26 11:27:51 mvs18oe oec[3014660]: Hello from oec

For more information about the syslog function, see Advanced Programming in the UNIX Environment, published by Addison-Wesley or z/OS XL C/C++ Runtime Library Reference.