Show Table of Contents
9.7. Debugging Rules
- Drools breakpoints are only enabled if you debug your application as a Drools Application. To do this you should perform one of two actions:
- Select the main class of your application. Right-click on it and select → .
- Alternatively, select → to open a new dialog window for creating, managing and running debug configurations.Select the Drools Application item in the left tree and click the button (leftmost icon in the toolbar above the tree). This will create a new configuration with a number of the properties already filled in based on main class you selected in the beginning. All properties shown here are the same as any standard Java program.
Note
Remember to change the name of your debug configuration to something meaningful. - Click the button on the bottom to start debugging your application.
- After enabling the debugging, the application starts executing and will halt if any breakpoint is encountered. This can be a Drools rule breakpoint, or any other standard Java breakpoint. Whenever a Drools rule breakpoint is encountered, the corresponding
.drlfile is opened and the active line is highlighted. The Variables view also contains all rule parameters and their value. You can then use the default Java debug actions to decide what to do next (resume, terminate, step over, etc). The debug views can also be used to determine the contents of the working memory and agenda at that time as well (the current executing working memory is automatically shown).
9.7.1. Creating Breakpoints
Create breakpoints to help monitor rules that have been executed. Instead of waiting for the result to appear at the end of the process, you can inspect the details of the execution at each breakpoint you set. This is useful for debugging and ensuring rules are executed as expected.
- To create breakpoints in the Package Explorer view or Navigator view of the JBoss BRMS perspective, double-click the selected
.drlfile to open it in the editor. - You can add and remove rule breakpoints in the
.drlfiles in two ways:- Double-click the rule in the Rule editor at the line where you want to add a breakpoint. A breakpoint can be removed by double-clicking the rule once more.
Note
Rule breakpoints can only be created in the consequence of a rule. Double-clicking on a line where no breakpoint is allowed does nothing. - Right-click the ruler. Select the action in the context menu. Choosing this action adds a breakpoint at the selected line or remove it if there is one already.
- The Debug perspective contains a Breakpoints view which can be used to see all defined breakpoints, get their properties, enable/disable and remove them. You can switch to it by clicking → → → .

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.