Question
· Jan 10

INFO level log entry from routing rule?

Is it possible to generate INFO level logging events from within a routing rule?

TRACE level events and debugging are easy enough, but we have a case where we have a rule where we want to log messages that are not routed for further processing in the event log as INFO events - in production tracing will be turned off, so TRACE level events won't be visible.

Product version: Ensemble 2018.1
$ZV: Cache for Windows (x86-64) 2018.1 (Build 184U) Wed Sep 19 2018 09:09:22 EDT
Discussion (5)3
Log in or sign up to continue

To my knowledge there is no Action to log an entry in the Interoperability Event Log, but it can be achieved using a custom function.

What you can do is implementing a function as documented in Defining Custom Utility Functions. 

Something like:

Class MyPackage.CustomFunctions Extends Ens.Rule.FunctionSet
{
/// Log an INFO type message in the Iteroperability Event Log
ClassMethod LogInfo(Message as %String) As %String
{
    $$$LOGINFO(Message)
    Quit Message
}
}

Then in your Rule add a Debug action that call/use the function:

Then, in the Business Process where the Rule is used, add the "d" flag to the RuleLogging settings:

This
way you will have your message logged in the event log AND in the rule log.

You could write a custom method that subclasses Ens.Rule.FunctionSet and includes Ensemble.inc (may already be included by default, haven't checked). There's a $$$LOGINFO() macro available that can be invoked from a method; that method would be called in an argument to an assign rule.

Here's an example:

Include Ensemble

Class IDC.Util.FunctionSet Extends Ens.Rule.FunctionSet
{
ClassMethod LogInfo(pText As %String) As %Status
{
	$$$LOGINFO(pText)
	Return $$$OK
}

}

Invoke it like this (or within another expression):

And debug is definitely a more sensible option than assign. Thanks, @Enrico Parisi 😁

Wow @Jeffrey Drumm !

It's amazing to see how we had the same idea/solution! 😂

Probably because it's a good idea/solution! 😊

Regarding the debug vs. assign action, maybe assign is easier and simpler to adopt because does not need to change RuleLogging setting that can "conflict" (mess) if more debug actions are used that are not required in production.
Using debug has the advantage to be able to disable the logging from portal/settings, if/when required.
It depends on the environment and requirements, soooo.....good we have to options! 😉

Having said that, it would be great if IRIS will add specific Action(s) to log info/warning/error in the event log.