Tip for debugging executeCommandLine

It’s possible everyone (except me) has always known this, but I’ve just discovered how to put the output of whatever script I call into the openhab logs.

val String result=executeCommandLine("myscript.sh",3000)
logInfo("EMAIL", "Command line result: {}",result)

I had always thought this would just show the exit value of the script - but it doesn’t… it takes everything that would go to stdin (if I ran myscript.sh directly) and copies it into openhab.log. Fantastic for debugging.

1 Like
logInfo("EMAIL", "Command line result: " + result)
1 Like

is there a difference in practice?

It does

To take it a step further, try this in Karaf…

log:set DEBUG org.eclipse.smarthome.io.net.exec


1 Like