CORBA 2.6 Programmer's Guide for C++
}
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