OSF DCE Application Development Guide--Introduction and Style Guide

Errors and Messaging
Routine administrative actions should be reported as informational messages. This
includes: creation, modification and deletion of tickets, threads, files, sockets, RPC
endpoints, or other objects; message transfer, including name lookup, binding, and
forwarding; and database maintenance, including replication or synchronization.
The severity level attribute for each message can be determined according to the
following criteria:
Fatal error exit (svc_c_sev_fatal_error). An unrecoverable error has occurred
requiring special manual recovery actions to take place, such as database restoration.
The program usually terminates immediately.
Error detected (svc_c_sev_error). An unexpected event that is nonterminal or is
correctable via human intervention has occurred, such as a timeout. The program
continues although some functions or services may not be available. This may also
be used to indicate that a particular request or action could not be completed.
Correctable error (svc_c_sev_warning). An error occurred that was automatically
corrected, such as a configuration file was not found so that defaults were used. This
may also be used to indicate a condition that may be an error if the effects are
undesireable, such as removing all files when a nonempty directory is removed. This
may also be used to indicate a condition that if not corrected will eventually result in
an error, such as when a printer is running out of paper.
Informational notice (svc_c_sev_notice). A predetermined major event has
occurred, such as a server started.
Verbose information notice (svc_c_sev_notice_verbose). A predetermined event
has occurred, such as a directory entry was removed.
Debug level 1 (svc_c_debug1) through debug level 9 (svc_c_debug9). Messages in
the nine debug levels would not normally appear in production code.
An appropriate action may be associated with an error message by ORing one of the
svc_c_action. . . values with the message attribute. Note that the svc_c_action_abort
action, which results in a call to abort( ), does not provide any reliable means to clean up
and should only be used where the default abort( ) action, which is typically to dump
core, is appropriate. Cleanup for the svc_c_action_exit action can implemented by
supplying an atexit( ) handler.
In addition to these guidelines, a persistent server application that does message logging
should consider exporting the remote serviceability interface as a means to simplify
server administration.
7.4 Sample Code
The sample server application source compiles a message catalog as well as the required
auxiliary .c and .h files from a sams file. In part, the file looks like the following (for the
full file, see Appendix A):
# Part I
component smp
124246 Tandem Computers Incorporated 75