PreviousNext

Calling dce_svc_routing( ) to Set Routing

Message routing can be set up by the application itself, by calling the routine dce_svc_routing( ) and passing to it a string formatted in the same way as a line of text from a routing file. The routine must be called separately for each severity level. When routing is specified this way, the routings so specified will override any conflicting routings specified by environment variable or routing file (as described in the preceding topics). This is especially useful for setting routes from command-line arguments.

For example, to set routing in this way for the hello_svc.c application described previously, use the following code:

unsigned_char_t *my_route = "NOTICE:STDOUT:-;TEXTFILE:/tmp/my_log";

unsigned_char_t *error_route = "ERROR:TEXTFILE:/tmp/errors_%ld";


dce_svc_routing(my_route, &status);

if (status != svc_s_ok)

{

printf("dce_svc_routing failed\n");

exit(1);

}


dce_svc_routing(error_route, &status);

if (status != svc_s_ok)

{

printf("dce_svc_routing failed\n");

exit(1);

}