[rules-users] Drools mvel consequence if (logEnabled) discussion/disabled if statement

Mark Proctor mproctor at codehaus.org
Wed Apr 13 15:43:54 EDT 2011


you can enable it yourself, it's configurable.

I think in the future we might no longer disable it. Instead we'll 
report that certain verifications couldn't be made.

Mark
On 13/04/2011 16:06, AberAber wrote:
> I know I've seen other posts saying that if statement in consequence has been
> disabled due to it being poor practice, but I see the use in logging.
>
> Lets say in consequence I have a complicated rule with 5 conditions and an
> action:
>
> modify($score) {
>      value = $score.value + 1;
> }
> if (log.debugEnabled) // errors since no if statement
> {
>        log.debug("Added score + 1 for file " + $file + " now has updated
> score of "+ $score.value);
> }
>
> This is impossible in mvel as if statement is disabled.  I still want my
> rule to fire if debug is disabled, so I can't add eval(log.debugEnabled) to
> rule.
>
> A stupid workaround is
> for (int x = 0; ((x<  1)&&  log.debugEnabled); x = x + 1) {
>
> I have a bunch of rules with different log change statements, so I see the
> use of adding if statement back for mvel.
>
> Is there a better workaround?
>
> --
> View this message in context: http://drools.46999.n3.nabble.com/Drools-mvel-consequence-if-logEnabled-discussion-disabled-if-statement-tp2816469p2816469.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