[rules-users] Anyway to get Failed Reason for Failed Rule?
Zhong, Jason
Jason.Zhong at ellucian.com
Fri Aug 10 09:19:06 EDT 2012
A simple solution is to pass in a string list and for each rule that is fired, append the rule name to the list. Example
In your Java code declare:
class RuleLog {
List log = new ArrayList();
public void add(String logEntry) {
log.add(logEntry);
}
...
}
Then insert an instance of RuleLog as a fact to the rules engine. The log entries generated can be retrieved after the rule session is completed.
In your rule:
rule "foo"
when
....
logger: RuleLog()
Then
// this will add the current rule name to the log when this rule is fired
logger.add(drools.getRule().getName())
...
end
Jason
-----Original Message-----
From: rules-users-bounces at lists.jboss.org [mailto:rules-users-bounces at lists.jboss.org] On Behalf Of Rana
Sent: Thursday, August 09, 2012 5:00 PM
To: rules-users at lists.jboss.org
Subject: Re: [rules-users] Anyway to get Failed Reason for Failed Rule?
Hi Davide, your second guess is right. Sorry I should have said failed
condition.
I wanted to know which rule got fired and which one did not (because the
condition failed in when clause).
I wanted to know those, because we have requirement which asks for what are
the rules which have passed and failed copnditions, so that we can make some
decisions.
Also, I wanted to know that in a rule
rule "name"
when
//condition
then
//consequence
end
when the condition is failed will the rule goes to consequence or not. (I
am fairely new to Drools. sorry).
Thanks.
--
View this message in context: http://drools.46999.n3.nabble.com/Anyway-to-get-Failed-Reason-for-Failed-Rule-tp4019070p4019077.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
rules-users at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
More information about the rules-users
mailing list