Logging and Exception Handling

Logs provide a method to figure out what is wrong with a process of the MDM system and may offer paths to solve these issues. This topic considers some of the recommended practices to log errors in the system and how to deal with exceptions.

Logging

The MDM system provides the option to set the detail level of business rules warnings and errors that should be logged in the log file. Logging many details may have a negative impact on performance, simply because the system will be busy logging these details.

It is therefore recommended to configure the business rule logging to avoid logging unnecessary details.

The amount of logging can be controlled globally (for all business rules) using the Log.Level.com.stibo.scripting.StepScriptEngineManager configuration property in the sharedconfig.properties file.

The values are ALL|FINEST|FINER|FINE|CONFIG|INFO|WARNING|SEVERE|OFF and use the appropriate level for each server environment consciously. For example:

  • Set the log level details on DEV and TEST to FINE to trace errors.
  • Set the log level details on QA to INFO or WARNING.
  • Set the log level details on PROD to SEVERE.

It is also possible to implement a 'log level' local to a specific business rule. For the logging of business rules, it is recommended to log the result of the business rule during development on the development server but remove the logging when development of the business rule is successfully finished and deployed to the test, quality, and production servers.

The use of business rule logging can be analyzed by examining the log file. In case the log file contains business rule remarks and results, then the business rule logs to the log file.

An easy and transparent way to turn logging on and off, is to set a Debug Flag in the business rule code.

For example:

//Debug 'flag' REMEMBER to turn 'false' when you are done
var isDebug = false;
//Function to handle whatever logging of debug information should occur or not
function logDebug(message) {
   if(isDebug) {logger.info(message)}
}
...
logDebug("This is a message for the log file")
...

Exception handling

Good exception handling practices will allow developers the opportunity to prevent negative side effects to the system. For more information of error handling practices in the system, refer to the Recommended Error Handling Practices topic in the Resource Material documentation here.