Debugging Processes
Testing processes often requires finding errors and removing them, which is called debugging.
Usually, a process is a black box. You can see that it runs and completes successfully or with an error. If a process fails, you cannot see the values of variables or a function's return value, which might have caused the error. Thus, one basic debugging tactic is to output such values while the process is running. The Application Engine contains some functions that allow to output such information during the test phase.
When you test a process in the
BI Process Editor,
you can use the
Write
and
WriteLine
functions to output values to the
Output tab in the right pane.
This output contains the process parameters, the process' return value, and
some other information. It also shows the output of the
Write
and
WriteLine
functions. This example demonstrates the
usage of the
WriteLine
function:
#define EngineVersion 1.0 void OutputDemo(string message) @Description: "Demonstrates output functions."; { WriteLine("This is a test!"); WriteLine(true); WriteLine(42); WriteLine(3.14); WriteLine("Message was: " + message); }
Output as much information as needed to see which values are
processed before you publish a process. When you have found and removed the
error cases, consider to remove the
Write
and
WriteLine
statements, because they are useless in
published processes.
Activate and configure the automatic
Repository
logging facility before you use the
Write
and
WriteLine
functions. The
Repository
logging can be used by all
Infor BI
products. You have to configure and activate the logging in
Infor BI Repository Administration.
See the
Repository
online help on how to configure the logging.
To log events of the Application Engine, create a filter that uses the event category Debug in Infor BI Repository Administration and ensure that it is activated. In this filter, you specify the IDs of all events that must be filtered out. You can show all events, but you can also limit them to the events that are generated by the Application Engine.
The Application Engine log events are described in this section:
When you have completed the logging configuration in Infor BI Repository Administration, restart the BI Process Editor. In test mode, select the check box Enable Logging to activate the logging. To run your process, click . The BI Process Editor automatically logs almost every single call of the BI# functions including all parameters and results. In most of the cases, automatic logging will help you to find the problem that happens in a process.
In addition to the
Write
and
WriteLine
functions, you can also use the log
functions.
The log functions are described in this section:
These log functions write process-specific information to the log, in addition to the automatic logging information. The configuration of the process-specific logging must be done in the same way as for the automatic logging described above. This example demonstrates the usage of the log functions:
#define EngineVersion 1.0 void LoggingDemo(string message) @Description: "Demonstrates logging functions."; { LogError(message); LogWarning("Write a warning to repository log."); LogInformation("Write information to repository log."); LogDebug("Write debug information to repository log."); }
Unlike the usage of
Write
and
WriteLine
functions, keep the log function calls in
your processes when you publish them. This way, you will later be able to
receive the log output also for published processes even in production
environments. In general, provide a minimal set of logging in most processes.
For example, it can be helpful to log the values of all parameters at the
beginning of the process and the result values.
Another possibility to receive information from a running process is the email function. The email function allows you to send emails within a process. Especially for long running processes, this can be helpful, because you can send an email once the process has done its work, for example. You can keep the email function in the published process, too, but you must be aware that email addresses and servers can change. If your process has to send emails, ensure that the email-specific information is passed to the process from the outside. Either specify the email-specific information as parameters or read them from a database, for example. This way, you can adjust them anytime without having to modify the process.
See the Notification functions section.