Home/Tutorials/Drools Business Rules Engine/How to debug a Drools project
Drools Business Rules Engine2 min read

How to debug a Drools project

This tutorial will let you the ways to debug a drools project

How to Debug a Drools Project

There are different ways to debug a drools project.

In this tutorial we will learn the one which requires 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 : Helper.java

package com.sample;

import org.drools.spi.KnowledgeHelper;

public class Helper {
	 
    public static void help(final KnowledgeHelper drools, final String message) {
        System.out.println(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.



INTERACTIVE SIMULATION CHALLENGE+250 XP
Workbench Verification

Ready to test "How to debug a Drools project" in production?

See how Drools Business Rules Engine algorithms and server loops perform under 100k req/s traffic spikes.

Simulator: SysDesign Ops Simulator