Closed boc-tothefuture closed 3 years ago
It would be good if we don't have to set the log level to DEBUG on org.openhab.core.automation. DEBUG adds a lot of extra information that could be distracting. Jython doesn't require DEBUG on this to see detailed script errors.
I will have to look at that because the setting is in the core. I would think it would be better for the core to log these problems at error level rather than debug. I am not sure the best approach is each language working around it.
I will take a look
After chatting with the JRuby developers, I opened an issue
Yes by default, Jython logs the line number albeit not too accurately, as I demonstrated in https://github.com/jruby/jruby/issues/6560#issuecomment-781822268
Jython helper libraries, does something extra to include the stack trace by decorating the rule with this: https://github.com/openhab-scripters/openhab-helper-libraries/blob/master/Core/automation/lib/python/core/log.py
@rule("test zonedatetime")
@when("System started")
def test(event):
asdf
And this is the output, thanks to the log_traceback
decorator
15:10:54.914 [WARN ] [jsr223.jython ] - Traceback (most recent call last):
File "/openhab/conf/automation/lib/python/core/log.py", line 65, in wrapper
return function(*args, **kwargs)
File "/openhab/conf/automation/lib/python/core/rules.py", line 109, in execute
self.callback(inputs.get('event'))
File "<script>", line 70, in test
NameError: global name 'asdf' is not defined
:tada: This issue has been resolved in version 2.26.0 :tada:
The release is available on:
2.26.0
Your semantic-release bot :package::rocket:
Thanks @pacive this works beautifully and it is very helpful to have the stack trace so informative.
Right now they go to stdout.. investigate if they can go to the log instead.