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.

e.g.

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.core.JobRunShell.run(JobRunShell.java:213)[102:org.eclipse.smarthome.core.scheduler:0.9.0.201611241831]
	at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)[102:org.eclipse.smarthome.core.scheduler:0.9.0.201611241831]
Caused by: java.lang.NullPointerException
	at org.eclipse.smarthome.model.rule.runtime.internal.engine.RuleContextHelper.getContext(RuleContextHelper.java:64)[126:org.eclipse.smarthome.model.rule.runtime:0.9.0.201611241831]
	at org.eclipse.smarthome.model.rule.runtime.internal.engine.ExecuteRuleJob.execute(ExecuteRuleJob.java:60)[126:org.eclipse.smarthome.model.rule.runtime:0.9.0.201611241831]
	at org.quartz.core.JobRunShell.run(JobRunShell.java:202)[102:org.eclipse.smarthome.core.scheduler:0.9.0.201611241831]
	... 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.

http://docs.openhab.org/features/automation/ruledsl.html

@Udo.
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: