PreviousNext

Using a Routing File

If a file called dce-local-path/svc/routing exists, the contents of the file (if in the proper format) will be used to determine the routing of messages written via serviceability routines.

The value of dce-local-path is usually /opt/dcelocal; the default location of the serviceability routing file is usually /opt/dcelocal/svc/routing. However, a different location for the file can be specified by setting the value of the environment variable DCE_SVC_ROUTING_FILE to the complete desired path name.

The routing file consists of formatted strings specifying the routing desired for the various kinds of messages (based on message severity). Each string consists of three fields as follows:

sev:out_form:dest[;out_form:dest ...] [GOESTO:{sev | comp}]

where:

sev
Specifies the severity level of the message, and must be one of the following:

· FATAL

· ERROR

· WARNING

· NOTICE

· NOTICE_VERBOSE

The meanings of these severity levels are explained in detail in Specifying Message Severity.

out_form
(output form) Specifies how the messages of a given severity level should be processed, and must be one of the following:

BINFILE
Write these messages as binary log entries.

TEXTFILE
Write these messages as human-readable text.

FILE
Equivalent to TEXTFILE.

DISCARD
Do not record messages of this severity level.

STDOUT
Write these messages as human-readable text to standard output.

STDERR
Write these messages as human-readable text to standard error.

Files written as BINFILEs can be read and manipulated with a set of log file functions, or with the svcdumplog command. For further information, see Logging and Log Reading.

The out_form specifier may be followed by a two-number specifier of the form:

.gens.count

where:

gens
Is an integer that specifies the number of files (that is, generations) that should be kept.

count
Is an integer specifying how many entries (that is, messages) should be written to each file.

The multiple files are named by appending a dot to the simple specified name, followed by the current generation number. When the number of entries in a file reaches the maximum specified by count, the file is closed, the generation number is incremented, and the next file is opened. When the maximum generation number files have been created and filled, the generation number is reset to 1, and a new file with that number is created and written to (thus overwriting the already-existing file with the same name), and so on, as long as messages are being written. Thus the files wrap around to their beginning, and the total number of log files never exceeds gens, although messages continue to be written as long as the program continues writing them.

dest
(destination) Specifies where the message should be sent, and is a path name. The field can be left blank if the out_form specified is DISCARD, STDOUT, or STDERR. The field can also contain a %ld string in the filename which, when the file is written, will be replaced by the process ID of the program that wrote the message(s). Filenames may not contain colons, semicolons, or periods.

Multiple routings for the same severity level can be specified by simply adding the additional desired routings as semicolon-separated strings in the following format:

out_form:dest

For example, consider the following:

FATAL:TEXTFILE:/dev/console

WARNING:DISCARD:--

NOTICE:BINFILE.50.100:/tmp/log%ld;STDERR:-

These strings specify that

· Fatal error messages should be sent to the console.

· Warnings should be discarded.

· Notices should be written both to standard error and as binary entries in files located in the /tmp directory. No more than 50 files should be written, and there should be no more than 100 messages written to each file. The files will have names of the form

/tmp/logprocess_id.nn

where process_id is the process ID of the program originating the messages, and nn is the generation number of the file.

The GOESTO specifier allows messages for the severity whose routing specification it appears in to be routed to the same destination (and in the same output form) as those for the other, specified, severity level (or component name).the component For example, the following specification:

WARNING:STDERR:;GOESTO:FATAL

FATAL:STDERR:;FILE:/tmp/foo

means that WARNING messages should show up in three places: twice to stderr, and then once to the file /tmp/foo.

Note that a GOESTO specification should be the last element in a multidestination route specification.