1

I have a rule similar to the below one. When I use logger.debug in THEN sections of the rule, it works and not while I use it in WHEN sections.

Any ideas why?

package com.util;
import com.rulemodel.*;
global org.slf4j.Logger logger;


rule "My rule"
dialect "mvel"
when
    $t : TransxnFact()
    $obj : BizObj((acType.equalsIgnoreCase("Check") && $t.getSubType().equalsIgnoreCase("TWO")) )   

then
  insert( new XXFact($t.getId() ) )
  logger.debug($t.getId()+ "fact inserted")
     logger.debug($x.getAcType())

end

I get the following error - Unable to resolve ObjectType 'logger.debug'

Spear A1
  • 525
  • 1
  • 7
  • 20

1 Answers1

1

In 'when' block you can define just condition. If you want to capture facts inserted in kiesession then you can use RuleRuntimeEventListener.

Abhijit Humbe
  • 1,563
  • 1
  • 12
  • 13
  • Thanks for the clarification Abhijit. Googling at the API RuleRuntimeEventListener, it does not seem to be as simple as logger.debug($t.getId()) . I would like to just do a SOP on the values, even before rule engine starts evaluating the RHS. – Spear A1 Oct 24 '18 at 15:16