简体   繁体   English

如何在Eclipse IDE中调试Drools(.drl)文件

[英]how to debug drools (.drl) file in eclipse IDE

I have a Java Spring project which calls drl file. 我有一个Java Spring项目,它调用drl文件。 While debugging, I want to see which rule is running and which condition is getting passed or failed. 调试时,我想查看正在运行的规则以及正在传递或失败的条件。 I am using Drools 5.3.0.Final runtime. 我正在使用Drools 5.3.0.Final运行时。

Please help me in debugging drl files. 请帮助我调试drl文件。

I'm not sure what the Eclipse plug-in of your version (5.3.0 is quite outdated) is capable of providing wrt debugging consequences. 我不确定您版本的Eclipse插件(5.3.0是否已经过时)能够提供wrt调试结果。 You might try to add an event handler, set a breakpoint in Java code on the handler for BeforeMatchFiredEvent, see what rule is about to fire and, eventually, step on from there. 您可能尝试添加事件处理程序,在处理程序上的Java代码中为BeforeMatchFiredEvent设置一个断点,查看将触发什么规则,并最终从那里开始。

As for seeing conditions passing or failing: perish the thought. 至于看到条件是通过还是失败:消灭思想。 Evaluation of conditions is a complex process, happening at odd times. 条件评估是一个复杂的过程,发生在奇怪的时间。 Watching this code being executed isn't available, and if it were, chances are that it would confuse you more than provide enlightenment. 无法观看正在执行的代码,如果有的话,很可能会给您带来更多启发,而不是给您带来启发。

For debugging complex conditions - say on a rule with N patterns - you might add rules containing pattern 1, then patterns 1 and 2, patterns 1, 2 and 3, etc, to learn what succeeds and what fails. 为了调试复杂的条件(例如,使用N个模式的规则),您可以添加包含模式1,然后模式1和2,模式1、2和3等的规则,以了解成功和失败的条件。 (To simplify this, you may make use of the "extends" clause of a rule.) (为简化此操作,您可以使用规则的“ extends”子句。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM