Question

I want to create a log such as System.out.println("RuleName : "+ruleName); in IBM ODM rule engine.

So these are what i did;

1- Create BOM virtual methods which are static and get parameter of instance which is the object of ilog.rules.engine.IlrRuleInstance.

instance ilog.rules.engine.IlrRuleInstance

2- Create BOM to XOM mapping by the following

System.out.println("Log icinde");
String ruleName = "";
if (instance != null )
    ruleName = instance.getRuleName();
else
    System.out.println("instance null!");
if (ruleName != null) {
    System.out.println("RuleName: "+ ruleName);
}
return;

3- Call it in rule flow as an initial or final action.

utility.logla(ruleInstance);

But when i execute the flow my log doesnt work instance is null and ruleName also is null;

How should i configure and set logging feature by using bom. Could you give me an example of it?

Thanks.

Was it helpful?

Solution

So you could use Decision Warehouse that is part of the execution server to trace each execution. This can include which rules have been fired during the execution, but depends on what filters you apply.

Here is the documentation on DW and how to set it up: http://pic.dhe.ibm.com/infocenter/dmanager/v8r5/topic/com.ibm.wodm.dserver.rules.res.managing/topics/con_res_dw_overview.html

OTHER TIPS

It is because you are calling the getRuleName() outside of the context of a rule instance within your rule flow, from what I can see from your description.

If you had a BOM method called from within the action of a rule, you could then call IlrRuleInstance.getRuleName() and it would return the name of the rule (I have done such a thing myself before).

What are you trying to achieve with this logging?

There is a much better way of logging from rules. In your Virtual method, pass the name of the rule itself rather than ruleInstance. You can also verbalize your method and use the same in each rule.

for e.g.: From BAL: Log the name of this rule ;

From IRL: Log(ilog.rules.brl.IlrNameUtil.getBusinessIdentifier(?instance.ruleName));

Another approach is to use the BAL provided above (the name of this rule) within the Rule Flow (Orchestration) for your Rule Application or Module.

Of course this solution should be used only for debugging or troubleshooting scenarios.

Hope this helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top