How to Debug a Drools Project

There are different ways to debug a drools project.

Writing a Utility class to let you know which rules are being triggered or fired.

With this approach we can check what all rules are getting triggered in our drools project.

Here is our Utility Class :

package com.sample;

import org.drools.spi.KnowledgeHelper;

public class Helper {
    public static void help(final KnowledgeHelper drools, final String message){
        System.out.println("\nrule triggered: " + drools.getRule().getName());
    public static void helper(final KnowledgeHelper drools){
        System.out.println("\nrule triggered: " + drools.getRule().getName());

The first method help prints the rule triggered along with some extra info which you can pass as String via the drl file.

The second rule helper prints whether the particular rule was triggered or not.