Openhab.log not useful for users

When moving to OH2 I found that the logs are hardly of use for a non- Java programmer.
On the one hand I am receiving tons of Java Error which I do not understand anyway.

But if I have a bug in this infamous DSL still only documented via “Google”, the error messages are non meaningful for me.


2016-11-27 09:08:01.283 [ERROR] [org.quartz.core.ErrorLogger         ] - Job (DEFAULT.all.rules#Track Fernsehzeit#0 * * * * ? threw an exception.
org.quartz.SchedulerException: Job threw an unhandled exception. [See nested exception: java.lang.NullPointerException]
	at org.quartz.simpl.SimpleThreadPool$[102:org.eclipse.smarthome.core.scheduler:]
Caused by: java.lang.NullPointerException
	at org.eclipse.smarthome.model.rule.runtime.internal.engine.RuleContextHelper.getContext([126:org.eclipse.smarthome.model.rule.runtime:]
	at org.eclipse.smarthome.model.rule.runtime.internal.engine.ExecuteRuleJob.execute([126:org.eclipse.smarthome.model.rule.runtime:]
	... 1 more

So reading the above, I now know that there must be “something” wrong a specific rule.
At least it points me to the name of the related rule.
If this rule is longer than a few lines, debug is getting super frustating.

Is there a user mode in the karaf console setting which enables a “user log”?

No. :slight_smile:

This is an unhandled NullPointerException, the only helpful way would be, to setup logging in the rule by adding log lines:

logInfo ("myRule","done this")
logInfo ("myRule","done that")
logInfo ("myRule","value 1 is {}",myValue1)
logInfo ("myRule","value 2 is {}, value 3 is {}",myValue2,myValue3)

You could use logWarn(), logError() and logDebug() and increase the log level when debugging. You can set the log level rule specific (if using different logger names) at runtime through karaf console.

I aware about this “debug” capabilties but honestly this reminds me of my Apple II in the 80th. I was so thrilled when I saw the JSR 233 approach with jython but this seems to go nowhere. This is sad and would be one of my top wishes.
And the jython had better debug logs that the DSL of today in OH2. But doc was even worse I have to admit.

And yes I know that everybody including myself could contribe changing the situation. And also I have to be thankful for what we have so far.

JSR233 is actively being updated to work with OH 2 soon. And there are changes to the core of OH 2 that will eventually make using different languages for Rules even easier. And there is a new Rules engine under development which is intended to address a lot of the problems and limitations of the existing Rules DSL.

I’d hardly say it’s going nowhere.

Thanks. I did not discover this but thanks for the information (and hope :-))

Really? How should the DSL know about what to tell you about occurring errors? In fact, every error log line is written in the program code, the developers can’t guess what sort of errors will appear in your rules :slight_smile: so it’s up to you to add helpful information in case of emergency :wink:

I took a look at JSR233 but was totally confused :cold_sweat: Maybe (sure after upgrading to OH2, I’m still stuck on OH1.8) I will take a second look at alternative Rule engines, but I have to admit, the existing DSL fits my needs :smiley: