PreviousNext

Setting Debug Levels

Nine serviceability debug message levels are available. The precise meaning of each level for an application is left to the developer; but the general intention is that ascending to a higher level (for example, from svc_c_debug2 to svc_c_debug3) should increase the level of information detail.

Setting debug messaging at a certain level means that all levels up to and including the specified level are enabled. For example, if the debug level is set at svc_c_debug4, then the svc_c_debug1, svc_c_debug2, and svc_c_debug3 levels are enabled as well.

A message can have a debug level attached to it in either of two ways:

· The debug level can be specified as one of the attributes in the message's definition in the sams file.

· If DCE_SVC_DEBUG( ) or DCE_SVC_LOG( ) is used to print the message, the debug level is specified in the call.

The debug level can be set by calling dce_svc_debug_set_levels( ) and passing to it a specially formatted string (the debug level is also set when debug routing is specified; see the next topic for further information). Levels can be separately specified for subcomponents. For example, suppose two subcomponents (rather than one) had been defined in the sams file for the hello_svc application at the beginning of this topic, as follows:

# Part II

serviceability table hel_svc_table handle hel_svc_handle

start

subcomponent hel_s_main "main" hel_i_svc_main

subcomponent hel_s_utils "utils" hel_i_svc_utils

end

The following string would, when passed to dce_svc_debug_set_levels( ), set the debug level for the main subcomponent to be svc_c_debug1, and the debug level for the utils subcomponent to be svc_c_debug4:

unsigned_char_t *levels = "hel:main.1,utils.4";

The general format for the debug level specifier string is as follows:

component:sub_comp.level,sub_comp.level,...

where:

component
Is the three-character component code for the program.

sub_comp.level
Is a subcomponent name, followed (after a dot) by a debug level (expressed as a single digit from 1 to 9). Note that multiple subcomponent/level pairs can be specified in the string.

If there are multiple subcomponents, and it is desired to set the debug level to be the same for all of them, then the following form will do this (where the * (asterisk) specifies all subcomponents).

component:*.level

The string can be passed to dce_svc_debug_set_levels( ) as follows:

dce_svc_debug_set_levels(levels, &status);

where levels is a string declared similarly to the example shown earlier in this topic.

The nine serviceability debug message level specifiers are as follows:

· svc_c_debug1

· svc_c_debug2

· svc_c_debug3

· svc_c_debug4

· svc_c_debug5

· svc_c_debug6

· svc_c_debug7

· svc_c_debug8

· svc_c_debug9