I had been wondering the same thing, so I finally decided to take a look @ the Drools source.

 

These log message are provided by the SystemEventListener interface.  There’s no direct way (that I can see) in the code to set and enforce an actual “log level” (Someone please tell me I’m wrong here.. I’d love to do this differently!)

 

What you need to do is implement your own SystemEventListener implementation to override the default one.  Before you do anything meaningful with Drools, you’ll want to override the default by calling:

   SystemEventListenerFactory.setSystemEventListener(<YOUR SystemEventListenerImpl>);

 

Here’s a basic no-op listener:

            new SystemEventListener () {

 

                  public void debug(String arg0) { }

                  public void debug(String arg0, Object arg1) {}

                  public void exception(Throwable arg0) {}

                  public void exception(String arg0, Throwable arg1) {}

                  public void info(String arg0) {}

                  public void info(String arg0, Object arg1) {}

                  public void warning(String arg0) {}

                  public void warning(String arg0, Object arg1) {}

                 

            };

 

In reality what you probably want to do is hook in your application’s logger here so it will respect the same log levels the rest of your application runs under.

 

Macon

 


From: rules-users-bounces@lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Andrew Waterman
Sent: Thursday, September 10, 2009 6:30 PM
To: Rules Users List
Subject: [rules-users] KnowledgeAgent Log Level

 

Hi,

 

I'm wondering if there is a way to manipulate the log level for the KnowledgeAgent.  Currently, I'm getting dumps to the console that I'd like to control:

 

[2009:09:253 17:09:371:info] KnowledgAgent applying ChangeSet

[2009:09:253 17:09:371:debug] KnowledgeAgent subscribing to resource=[ClassPathResource path='mx/ecosur/multigame/impl/manantiales.drl']

[2009:09:253 17:09:371:debug] ResourceChangeNotification subscribing listener=org.drools.agent.impl.KnowledgeAgentImpl@3ebfd8 to resource=[ClassPathResource path='mx/ecosur/multigame/impl/manantiales.drl']

[2009:09:253 17:09:372:debug] KnowledgeAgent ChangeSet requires KnowledgeBuilder

[2009:09:253 17:09:372:debug] KnowledgeAgent rebuilding KnowledgeBase using ChangeSet

[2009:09:253 17:09:373:debug] KnowledgeAgent building resource=[ClassPathResource path='mx/ecosur/multigame/impl/manantiales.drl']

[2009:09:253 17:09:420:info] KnowledgeAgent new KnowledgeBase now built and in use

 

Thanks!

 

best wishes,

 

Andrew

---------------------------------

Andrew Waterman

San Cristóbal de las Casas, Chiapas, Mexico