Open System Services Programmer's Guide
Table 29 OSS Logging Function Parameters and Default Values
Description of Default ValueDefault Valueof FunctionParameter
Logs messages generated by
user processes and displays
the facility string USER.
LOG_USERopenlog()facility
Causes the identity string
“syslog” to appear in
messages.
“syslog”openlog()ident
Assigns the level LOG_INFO
to the event and displays the
level string INFO.
LOG_INFOsyslog()level
Opens a collector process
only when the first message
is logged.
LOG_ODELAYopenlog()logopt
Logs events of all priorities.LOG_UPTO (LOG_DEBUG)setlogmask()maskpri
Points to the display format
and text that you supply.
syslog()message
The values of these parameters appear in an OSS logging message in the following order:
facility level[,PID = pid] (identity) : message-text
The content of message-text is pointed to by the message parameter.
The values of the logopt and maskpri parameters do not appear in OSS log messages.
The OSS process ID appears in the message if you specify the LOG_PID option in the logopt
parameter of the openlog() function, as described in “logopt Parameter” (page 240).
Specifying a Collector
A user of your application can specify an EMS collector process from the shell by setting the OSS
environment variable EMS_COLLECTOR to the desired collector. You must export the variable
before using the collector. You use the export command to both set the value of the variable and
export it as follows:
export EMS_COLLECTOR=\$COL
In this example, the backslash (\) is required to prevent the shell from interpreting $COL as a shell
variable, and $COL represents the name of the collector.
You can have event messages sent to $0, the local primary collector, if, for some reason a message
cannot be sent to the collector specified by a user with the EMS_COLLECTOR environment variable.
To send events to $0 as a backup, specify the LOG_CONS option in the logopt parameter of the
openlog() function, as described in “logopt Parameter” (page 240).
Specifying the Severity Level of Logged Events
You can specify the severity level of events you want logged by setting the maskpri parameter
of the setlogmask() function. For example, setting the maskpri parameter to LOG_WARNING
causes only events of severity LOG_WARNING to be logged.
You can use the LOG_UPTO operator in the maskpri parameter to select the level through which
events are logged. For example, setting maskpri to LOG_UPTO(LOG_INFO) causes all events
except those of LOG_DEBUG to be logged. There is no default value for maskpri, so you must set
this value yourself.
Table 30 lists the names and event numbers of the level parameter in descending order of
severity. The level parameter is also displayed as a string in the message, and this string is also
listed in Table 30.
238 Using Logging Mechanisms