When debugging errors and exceptions in rules I sometimes see rule file name or rule name but I don’t see which line number in the rule file that caused the error.
As a programmer I find that odd and unusual. I don’t like to resort to log statements which may themselves cause errors, and try catch is a separate concern that should not be mixed into rules just for the sake of pinpointing an error.
Adding %L to log config does not yield the correct line number, as also hinted here.
The simplest illustration I could come up with would be this, with the expected line number 5:
rule "Exception line number"
when
System startup
then
logInfo("test " + 1/0)
end
Which logs this:
2020-04-28 20:42:01.259 [ERROR] [.model.rule.runtime.internal.engine.RuleEngineImpl: 319] - Rule 'Exception line number': / by zero
using this log pattern:
log4j2.appender.out.layout.pattern = %d{yyyy-MM-dd HH:mm:ss.SSS} [%-5.5p] [%-50.50c:%5.5L] - %m%n
This is of course a trivial example, but rules can easily become unwieldy as I’m sure you know.
As long as it’s not possible, Rules DSL is clearly not for me.