CORBA 2.6.1 Programmer's Guide for C++

A short description of the error
A list of actions that you can perform to resolve the problem
Error Logging Examples
The following code shows how to log an error using C++ exceptions:
try {
some CORBA work
}
catch (const CORBA::Exception& ex ) {
NSDOM_LOG_ERROR_EXC (7003, "Error writing to CustDB", ex );
}
The following code shows how to log an error using if/then logic. This technique is usually less desirable than using exceptions..
some CORBA work
...
if (!CORBA::environment::default_environment().OK())
// log an error
LOG_ERROR_ENV( 7003,
"Error writing to CustDB", lv_env);
...
}
How the Error Logging Facility Works
As a user of the error logging facility, you need not know how the actual API calls NSDOM_Error_Log. You should use the error logging macros
provided and let them call the API methods. However, you might find it useful to know how the error logging facility works.
The public API section of the error logging facility is based on the severity levels of the messages you log: Critical, Error, Warning, or
Informational. These severity levels are reflected in the methods defined in the
NSDOM_Error_Log, as shown in the following code.
class NSDORB_Export NSDOM_Error_Log : public NSDEFw_Error_Log
{
public:
//
// construct log, NO file open
//
NSDOM_Error_Log();
//
// construct log, NO file open
// if pp_log_file_name is "<STDOUT>", then stdout is used
// if pp_log_file_name is "<STDERR>", then stderr is used
//
NSDOM_Error_Log(char *pp_log_file_name);
virtual ~NSDOM_Error_Log();
//
// log critical/error/warning/info message
//
void log_critical(char *pp_src_file_name, // name of src file
int pv_src_line_num, // line num of src
long pv_err_num , // error number
char *pp_text); // text
void log_critical(char *pp_src_file_name, // name of src file
int pv_src_line_num, // line num of src
long pv_err_num , // error number
char *pp_text, // text
const CORBA::Exception &pr_ex); // exception
void log_error(char *pp_src_file_name, // name of src file
int pv_src_line_num, // line num of src
long pv_err_num , // error number
char *pp_text); // text
void log_error(char *pp_src_file_name, // name of src file
int pv_src_line_num, // line num of src
long pv_err_num , // error number
char *pp_text, // text
const CORBA::Exception &pr_ex );// exception
void log_info(char *pp_src_file_name, // name of src file
int pv_src_line_num, // line num of src
long pv_err_num , // error number
char *pp_text); // text
void log_info(char *pp_src_file_name, // name of src file
int pv_src_line_num, // line num of src
long pv_err_num , // error number
char *pp_text, // text
const CORBA::Exception &pr_ex ); // exception
void log_warning(char *pp_src_file_name, // name of src file
int pv_src_line_num, // line num of src
long pv_err_num , // error number
char *pp_text); // text
void log_warning(char *pp_src_file_name, // name of src file
int pv_src_line_num, // line num of src
long pv_err_num , // error number
char *pp_text, // text
const CORBA::Exception &pr_ex );// exception
//
// static method returns default log object
//
static NSDOM_Error_Log &get_default();
};
Using the Trace Facility