Using logging

Last Updated: 12/05/2015 Introduced in Verision: 2.0


The Decisions server logs are stored in a csv file on the server at   C:\Program Files\Decisions\Decisions Services Manager\Decisions.CONTROLINSTANCE.log.csv. Utilizing these logs can be extremely important to debugging code that you’ve written. But before you can use these log effectively to debug your code, you need to know how your code can interact with these logs. The following describes how the different levels at which you can write logs and how to control with levels are written.

Logging Levels

Messages can be written to these logs at numerous levels which include the following:
  • Info
  • Debug
  • Warn
  • Error
  • Fatal

Logging at the Information and Debug levels will dramatically increase the size of log files over time, and negatively impact performance. These levels should only be turned on when necessary for troubleshooting, or for demonstrations.

The levels that are actually written to the log file can be control via the  Settings.xml  file which is located at  C:\Program Files\Decisions\Decisions Services Manager\Settings.xml. In this file, the settings for enabling/disables these log levels are located in the following tags.

Writing to the Logs

To write to the Decisions logs from your code, you first need to instantiate a  DecisionsFramework.Log. With this, you will be able to write to the logs at the different levels describes above.
Many of these level have the same input data. Here is a list of the pieces of input data used by these levels and how that data is used in the logs.
  • object sourceObject: The logger will attempt to do a .ToString() on the object and write that string in your log entry.
  • string message: This is the main part of your log message. You can write custom text here to signal where in your code you are. You can only merge in error message that have been caught.
  • params object[] arguments: This allows you input parameter into your log message. For example, you could write a log entry like this:  LogDebug(this,"{0} {1} {2} is today", "Thursday", "Jan 10th", "2013");
Below is comments sample code that explains the different levels. The attached project contains this code and can be compiled and deployed as a steps to allow you to test different combinations with the logging levels.


Accessing Logs

The Decisions logs can be accessed in two ways.
You can open the CSV file directly. This file is stored at  C:\Program Files\Decisions\Decisions Services Manager\Logs\\Decisions.CONTROLINSTANCE.log.csv.
Alternatively, you can view the logs from the Decisions portal by navigating to System > Logging.
Fatal and error-level errors are also logged as Windows events for monitoring by external tools.

Additional Resources