How to remote debug a binding?

I am working on an update to an hdmi-cec binding that code was posted for. I am having some wierd effects that are hard to figure out with debug log entries.

The target device is a raspberry pi, running the pre-built image.
I am developing with eclipse on windows. I don’t run openhab locally as i don’t have the hdmi setup needed to test with.

if i run start_debug.sh it complains about a root instance already running. if i kill that with servicectl, and then try the shell script, it fails with not finding the user profile stuff it needs. ( sorry i am being vague, i’m tapping this out on my phone in a free minute, and i’m not at my PC.

is there a doc or post on how to set this up?

1 Like

You don’t need to run openHAB in debug mode, just enable debug level logging for your binding
(log:set org.openhab.binding.<yournamehere>) as in

Remote debugging is not possible with the default openHAB. You would need to start the karaf container that starts all the bundles in a specific way. See https://karaf.apache.org/manual/latest-2.x/developers-guide/debugging.html

1 Like

Aha, that solved my issue. Debugging revealed an exception that somehow was being swallowed and not reported in the logs.

I had this one many times. Temporarily put catch(Throwable e) around suspicious code. Catching Throwable is not recommended but in real life bookish rules don’t help. So called “ugly” code helps.