The InRule Rule Engine provides the following ways to obtain detailed logs of events that occur during execution to aid the debugging of a rule application:
- The RuleExecutionLog class provides information on state changes and rules firing.
- Rule tracing provides the chronological sequence of activities, including the constituent components the rule engine uses to evaluate a rule
As with the RuleExecutionLog, rule tracing is accessible after either an ApplyRules or ExecuteRuleSet has been issued to the RuleSession. By default, rule tracing is disabled; it can be enabled either through irVerify or programmatically through irSDK. Unless the trace is persisted, it will be replaced during a subsequent rule execution. Rule tracing does not have to capture every activity that occurs during rule execution; it can be selective based on a filter constructed prior to rule execution. The output of the rule trace is presented in XML form. A user may elect to output the rule trace as XML in its entirety, or navigate to and output a specific section using a trace reader provided by irSDK.
The following topics provide assistance for working with rule tracing:
A developer can also work with irSDK to create and persist rule traces using a variety of configuration options. Refer to the Runtime API Examples for further detail.
Long-running / Complex Rule Executions
Rule Tracing has been optimized to minimize memory use and reduce performance overhead. However, there is always going to be some noticeable drag on performance when tracing is enabled. By default, tracing is disabled (TraceFrameType.None) so tracing is an explicit opt-in requirement.
A rule execution with all frame types enabled, producing several hundred thousand or even million trace frames may be unmanageable when used within irVerify. Using the irSDK to write XML to a file instead of an in-memory object or string is sometimes a better approach.
The total number of frames reported by the RuleExecutionLog.TotalTraceFrames property provides an idea of the trace size before attempting to render it. In some cases a large trace can take several minutes to render even on a fast machine. The value of TotalTraceFrames can be checked before calling RuleExecutionLog.GetExecutionTrace().
Temporary Trace File Location
During rule execution, the trace files will be persisted under the InRule temporary file location. By default this located at %TEMP%\InRule\Temp.
Please sign in to leave a comment.