The event package provides machanisms to be notified of rule engine events such as rules firing & objects being asserted. This allows you to separate out the logging and auditing activities from the main part of your application as well as your rules. This seperation is important as as events are a concern which will cover many different parts of your application.
There are three types of event listeners:
WorkingMemoryEventListener
AgendaEventListener
RuleFlowEventListener



Both stateful and statless sessions implement the EventManager interface, which allows event listeners to be added to the session.

All EventListeners have default implementations that implement each method, but do nothing, these are convienience classes that you can inherit from to save having to implement each method (DefaultAgendaEventListener, DefaultWorkingMemoryEventListener,DefaultRuleFlowEventListener). The following shows how to extend DefaultAgendaEventListener and add it to the session, the example prints statements for only when rules are fired:
session.addEventListener( new DefaultAgendaEventListener() { public void afterActivationFired(AfterActivationFiredEvent event) { super.afterActivationFired( event ); System.out.println( event ); } });
Drools also provides DebugWorkingMemoryEventListener, DebugAgendaEventListener and DebugRuleFlowEventListener that implements each method with a debug print statement:
session.addEventListener( new DebugWorkingMemoryEventListener() );
The Eclipse based Rule IDE also provides an audit logger and graphical viewer, so that the rule engine can log events for later viewing, and auditing.