简体   繁体   中英

Drools unable to resolve logger

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'

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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