[rules-users] JBoss Rule Trace feature with 5.0

Wolfgang Laun wolfgang.laun at gmail.com
Mon Sep 20 02:49:20 EDT 2010


2010/9/19 Kinjal Khandhar <kinjal.khandhar at gmail.com>
>
> Hi All,
> Can anybody help me with Drools Audit Log(Rule Trace) feature.

          import org.drools.audit.WorkingMemoryFileLogger;
          WorkingMemoryFileLogger logger = new
WorkingMemoryFileLogger( session );
          logger.setFileName( "event" );
           ... fireAllrules()...
          logger.writeToDisk();

Package org.drools.audit.event contains Filter classes; you may pass
suitables instances to
logger.addFilter() to reduce the volume on the log file.

You should probably use an ActivationLogEventFilter permitting the
creation and firing of Activations. The former will tell you which
conditions were fully evaluated, and the latter which rules were
fired. (A WorkingMemoryLogEventFilter permitting nothing will keep WM
operations at bay.)

Or, you could set up a event listener
(implementorg.drools.event.rule.AgendaEventListener), and see
org.drools.event.rule for the subinterfaces of ActivationEvent. This
saves you the bother of processing the XML log file, and you'll get
the Rule information easily enough:

   ((ActivationEvent)event).getActivation().getRule().getName() and
...getPackageName()

Since you'll only need Sets of activations and firings, this approach
may be preferable.

To learn which rules were never activated, you can access the
Knowledge Packages in your Knowledge Base, iterate over the rules and
create a set of all rules; subtracting those from the log will give
you the required information.

-W


>
> My goal is to check which rule got executed,in what sequence and which conditions got evaluated and which did not.
> Any help/pointers greatly appreciated.
> Thanks in advance.
> Regards,
> Kinjal
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>




More information about the rules-users mailing list