Debugging Rules

There are a number of directives and techniques that help with the debugging of rules. These all rely on the placement of entries into the application server log. These entries may be viewed with the Admin --> System Controls --> System Log --> View Application Server Log utility. Note the ability of this screen to be able to refresh the most recent entries. You can leave this window open as a message area while you alter rules and test their results in a different window.

After debugging, it is strongly suggested that you remove, or comment, the debugging directives, as they have a small impact on performance.

Directive Use
debug Turns on the debugging. All messages from rules execution are written to the log, until the end of rules execution, or until an <== end ==> directive is encountered
end Ends all processing of rules and stops debugging messages being sent to the log
info Causes log entries to verify that rules are being executed. Minimal details are listed
log Logs rule activity in enough detail for end users to verify rule execution. Shows condition evaluation and assignments until the end of the rules, or until a <== nolog ==> directive is encountered
nolog Turns off the <== log ==> directive

For example, create these rules:

<== load ==>
<== nolog ==>
if (AREA.{is not null}) SHORT_DESCR = 'Set at NO logging';
<== info ==>
if (AREA.{is not null}) SHORT_DESCR = 'Set at INFO level of logging';
<== log ==>
if (AREA.{is not null}) SHORT_DESCR = 'Set at LOG level of logging';
<== debug ==>
if (AREA.{is not null}) SHORT_DESCR = 'Set at DEBUG level of logging';
<== info ==>

The results from this will look something like this:

2010-07-20  16:10:34  [  info   ] ExtraView. TP-Processor7 ,122118,TP-Processor7,
>>>Entering service,Display.doAddDisplay,,,sc,0,,,uid,BSMITH,tmem,41,fmem,10,nid
,http://nerdvana.extraview.net/evj ON WS_A:
2010-07-20  16:10:35  [  info   ]  TP-Processor7 ** Rules60: * Executing: 
# L0000
if (AREA.{is not null}{not null} ()) { 
    SHORT_DESCR = Set at NO logging (Set at NO logging);
}
2010-07-20  16:10:35  [  info   ]  TP-Processor7 ** Rules60: * Executing: 
# L0001
if (AREA.{is not null}{not null} ()) { 
    SHORT_DESCR = Set at INFO level of logging (Set at INFO level of logging);
}
2010-07-20  16:10:35  [  info   ]  TP-Processor7 ** Rules60: * Executing: 
# L0002
if (AREA.{is not null}{not null} ()) { 
    SHORT_DESCR = Set at LOG level of logging (Set at LOG level of logging);
}
2010-07-20  16:10:35  [  info   ]  TP-Processor7 ** Rules60: * Executing: 
# L0003
if (AREA.{is not null}{not null} ()) { 
    SHORT_DESCR = Set at DEBUG level of logging (Set at DEBUG level of logging);
}
2010-07-20  16:10:35  [  info   ] ExtraView. TP-Processor7 ,122118,TP-Processor7,
>>>Leaving  service,Display.doAddDisplay,time,1357,sc,0,cc,46,mc,0,uid,BSMITH,tmem,41,
fmem,12,nid,,http://nerdvana.extraview.net/evj ON WS_A:

Note the effects of the different directives.