Execution trace for execution Java API

You might want to retrieve execution traces of an engine. You define what information is recorded in the trace by using trace configuration.
You need to set the trace configuration com.ibm.decision.run.trace.TraceConfiguration for the run context before the execution, as shown in the following example:
RunContext runContext = runner.createRunContext(executionId);
TraceConfiguration tc = new TraceConfiguration();
tc.rules.allRules = true;
tc.rules.executedRules = true;
tc.rules.nonExecutedRules = true;
runContext.setTraceConfiguration(tc);
runner.execute(input, runContext);
Trace trace = runContext.getTrace();
The information in the trace depends on the trace configuration and the type of execution unit. For example, if you have the trace of a ruleflow engine, and the trace configuration is set correctly, you can get a list of non-executed rules by writing:
trace.rootRecord.properties.get("nonExecutedRules")
Tip: You can use the objectsInMemoryLimit option in com.ibm.decision.run.trace.TraceConfiguration to manage the memory used by the trace.

For more information, see the classes com.ibm.decision.run.trace.Trace, com.ibm.decision.run.TraceRecord, and com.ibm.decision.run.trace.TraceConfiguration in the Execution Java™ API reference in Reference.

Sample

The sample Executing a decision service in Java is available in GitHub. It contains a sample code that displays execution traces. Click Decision Intelligence Client Managed Software samples External link opens a new window or tab to be redirected to the GitHub repository.