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 JavaScript.Logging.LogLevel configuration property globally controls the amount of logging for all business rules. In the Self-Service UI, select an environment and click the 'Configuration properties' tab to edit the property.

The available values are:

  • All

  • Finest

  • Finer

  • Fine

  • Config

  • Info

  • Warning

  • Severe

  • Off

Use the appropriate level for each environment, for example:

  • For a DEV or TEST environment, set the property to FINE to trace errors.

  • For a QA environment, set the property to INFO or WARNING.

  • For a PROD environment, set the property 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 environment but remove the logging when development of the business rule is successfully finished and deployed to the test, quality, and production environments.

The use of business rule logging can be analyzed by examining the log file. If the log file contains business rule remarks and results, 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 on error handling practices in the system, refer to the Error Handling Recommended Practices topic in the Resource Materials online help documentation.