How to enable log files on OH3?

  • Platform information:
    • Hardware: CPUArchitecture/RAM/storage
    • OS: what OS is used and which version
    • Java Runtime Environment: which java platform is used and what version
    • openHAB version:
  • Issue of the topic: please be detailed explaining your issue
  • Please post configurations (if applicable):
    • Items configuration related to the issue
    • Sitemap configuration related to the issue
    • Rules code related to the issue
    • Services configuration related to the issue
  • If logs where generated please post these here using code fences:

How do you enable to start logging into files in openhab 3 (openhabian)?
Yes, I’ve searched community and also looked at official documentation: Logging | openHAB
It says “manual”, but what is manual? Edit log4j2.xml file?

But I really do not understand how to enable it in log4j2.xml file.
There is no LOG folder in openhab/userdata :frowning:

Spent 3 hours on this already but I’d rather tell everyone I’m not understanding it than spend more time in the dark.
Thanks

It does so by default already. Where it logs to depends on how OH is installed. If you are using openHABian, you didn’t install OH using the manual installation instructions. Have you looked in /var/log/openhab?

All the important file locations are also documented: openHAB on Linux | openHAB

Since you’ve installed using openHABian, you’ve also Frontail available on port 9000 which shows the logs in your browser. openHABian | openHAB

1 Like

Small correction: frontail should run on 9001, not 9000 :slight_smile:

2 Likes

Thanks @rlkoshak and @BobMiles for pointing me in the correct direction.
I had totally missed to add the samba share in /etc/samba/smb.conf

[openHAB-logs]
  comment=openHAB logs
  path=/var/log/openhab
  browseable=Yes
  writeable=Yes
  only guest=no
  public=no
  create mask=0777
  directory mask=0777

I can see this in my openhabian-setup (/etc/samba/smb.conf):

; ATTENTION: /var/log is on zram
; Sharing this will cause data loss of logs
; You can uncomment this but you have been warned

Do you have ZRAM enabled? Default is YES.
But I did setup my system 1 year ago and maybe this is no risk anymore in newer releases of openhabian?