Openhab Debugging started as service?

I got openhab running on my mac for a long time without any major problems.

Now I have switched to an odroid u3 as a linux beginner.
Worked fine at the beginning but sometimes I do get a lot of errors.

On my mac I would have started with start_debug.sh for debugging…

What is the best way to get this done on wheezy with openhab started as service?
Is there a way to show the debug_log in terminal?

I assuming you mean can you run it showing the log and when you close the terminal screen it keeps going?

If so have you tried screen? Allows it to keep running when logged out.

Josh

Assuming it’s similar to wheezy on a Raspberry Pi, you can stop the service (“sudo service openhab stop”) and then run the start_debug.sh script from a command line.

Lots of good advice here already.

Based on your question I’m assuming you are running it as a service.

So on the RasPi you can stop openHAB with the command:

sudo service openhab stop

Then you can run openhab using the start_debug.sh and the debug logs will be printed to the screen as @steve1 recommends.

Another approach is to stop openHAB and swap the logback.xml and logback_debug.xml files in your config folder (if you installed using apt-get that is in /etc/openhab. Then you can restart openHAB using

sudo service openhab start

And watch the logs by tailing the log file

tail -f /var/log/openhab/openhab.log

start_debug.sh is not available in apt-get installation.
BUT the tail command is exactly what I was looking for.

Thank you for your support

How do you start it in debug mode since “start_debug.sh” isn’t available in an apt-get installation?

Asuming openHab is already running you can use the tail command mentioned above to continuously print the log to command line. If the log is not detailed enough, you have to edit the logback.xml to set your level of logging.

/opt/openhab/configurations/logback.xml and /opt/openhab/configurations/logback_debug.xml

Logback_debug = logging like start_debug.sh

So if you copy logback_debug to logback and using tail command you should get the same result as start_debug.sh

Reading through the /etc/init.d/openhab file, it looks like if you add a line

DEBUG=yes

it will use the debug options in the launch command. I haven’t done so myself, but one of the arguments is to use logback_debug.xml.

After a bit of trial and error from the suggestions above i found that the correct(?) way to do it is in the file /etc/default/openhab to change DEBUG=no to DEBUG=true

2 Likes

what worked for me (jessy, OH 1.8)
/etc/default/openhab to change DEBUG=no to DEBUG=true
reboot
tail -f /var/log/openhab/openhab.log

When I use the tail -f /var/log/openhab/openhab.log, the output freezes. Any suggestions ?

When installing with apt it seems to use systemd now (running ubuntu 16.04 xenial) so > /etc/default/openhab i think is no longer used.
Looking into > /usr/lib/systemd/system/openhab.service i Couldn’t find an equivalent option to DEBUG=true.

Right now my only option seems to be replaceing the with the debug version of the log xml file.

I know this thread is very old, but I just stumbled across this through a Google search and the solutions posted here didn’t work for me. Just changing the log level as suggested above won’t help either if you intend to use a JVM debugger.

In case anyone finds this who is using Arch Linux or systemd in general, just edit
/usr/lib/systemd/system/openhab3.service and change
ExecStart=/usr/share/openhab3/karaf_wrapper.sh server to
ExecStart=/usr/share/openhab3/karaf_wrapper.sh server debug.
I hope this helps someone!

1 Like