Fresh installation no openhab.log file

  • Platform information:
    • Hardware: CPUArchitecture/RAM/storage Orange Pi Zero 2 1GB
    • OS: what OS is used and which version Armbian 26.11.0 Minimal Debian 13
    • Java Runtime Environment: which java platform is used and what version 21.0.12.1
    • openHAB version: 5.2.1
  • Issue of the topic: I installed armbian on SD card through armbian imager, then install java using install default java command. I then installed openhab manually using apt. However there is no file of openhab.log at /var/log/openhab/openhab.log
    • However, I can see the log in web console as well as by using log:tail
  • Where might be the file to access using putty?

It’s likely something is wrong with your logger config or permissions.

You can find the logger config at /var/lib/openhab/etc/log4j2.xml. The default version of this file can be found at openhab-distro/distributions/openhab/src/main/resources/userdata/etc/log4j2.xml at main · openhab/openhab-distro · GitHub.

I think that the apt installer is supposed to create the logger folder but double check that /var/log/openhab exists. If not try creating it.

I don’t know if Armbian makes its own apt package and/or does something different from the “normal” apt package, but if so it might be putting the logs somewhere else. The log4j2.xml file should tell you where it’s trying to write to.

Note: the log viewer in MainUI is independent from the log files.

also on a fresh apt install ive had /var/log/openhab missing or owned wrong so logging never starts. check ls -ld /var/log/openhab and that openhab owns it, then journalctl -u openhab -b to see if the service actually came up. if log4j2.xml looks empty or half written, drop in the default from the distro link above and restart the service.

I did create the directory and log files manually. However it still did not update the file.

On running the commands suggested by you, following is the outcome.

root@orangepizero2:~# ls -ld /var/log/openhab
drwxr-xr-x 2 root root 4096 Sep 8 21:44 /var/log/openhab

Sep 04 19:00:16 orangepizero2 systemd[1]: Started openhab.service - openHAB - empowering the smart home.
Sep 04 19:37:12 orangepizero2 karaf[1137]: mkdir: cannot create directory ‘/var/log/openhab’: Permission denied
Sep 04 19:37:17 orangepizero2 karaf[859]: java.lang.RuntimeException: /var/log/openhab/openhab.log (No such file or directory)

root@orangepizero2:~# chown openhab /var/log/openhab

root@orangepizero2:~# ls -ld /var/log/openhab
drwxr-xr-x 2 openhab root 4096 Sep 9 11:47 /var/log/openhab

However after doing this also, the log file did not get updated.

The ownership of the /var/log/openhab directory needs to be openhab:openhab or the permissions need to the rwx for group and other also.

Make sure there are no files in that directory to start. OH will create the files as it need to.