OpenHAB not writing to /var/log/openhab.log

  • Platform information:
    • Hardware: Pi 4
    • OS: openhabian
    • openjdk version “11.0.13” 2021-10-19 LTS
      OpenJDK Runtime Environment Zulu11.52+13-CA (build 11.0.13+8-LTS)
      OpenJDK Client VM Zulu11.52+13-CA (build 11.0.13+8-LTS, mixed mode)
    • openHAB version: 3.4

Hi all - Merry Christmas!

About 5 days ago, I swapped my SD card through mirroring and upgraded to 3.4.

A couple days later (I was very busy) I noticed RRDJ4 was not logging. I changed the log level to DEBUG but then noticed that /var/log/openhab.log was not populating. Events and HABApp logs work fine, but nothing in audit.log or openhab.log.

I cleared cache, did a few reboots and eventually it looks like the RRDJ4 started updating… but still no logging.

I would get errors in openhabian-config trying to reset permissions, and found that the zram file was ending up read-only, so I followed some threads to change the ztab file and that allowed me to fix permissions, and no issues in dmesg that I can see.

openhab.log gets re-created when deleted and openhab is restarted, but never gets a fresh timestamp.

-rw-r--r-- 1 openhab openhab        0 Dec 25 14:27 openhab.log

I have the same problem with a default log4j2.xml file…

I’d post more details, but not 100% sure what else to post?

Any thoughts?

please check if logging is configured correctly (this is: go to $OPENHAB_USERDATA/etc/ and check files log4j2.xml and org.ops4j.pax.logging.cfg. The latter should contain one line


while the former should contain the configuration for logging.

Thanks @Udo_Hartmann

cat org.ops4j.pax.logging.cfg

and the relevant section of log4j2.xml - events.log works fine…

		<!-- Console appender not used by default (see Root logger AppenderRefs) -->
		<Console name="STDOUT">
			<PatternLayout pattern="%d{HH:mm:ss.SSS} [%-5.5p] [%-36.36c] - %m%n"/>

		<!-- Rolling file appender -->
		<RollingFile fileName="${sys:openhab.logdir}/openhab.log" filePattern="${sys:openhab.logdir}/openhab.log.%i.gz" name="LOGFILE">
			<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5.5p] [%-36.36c] - %m%n"/>
	                <RegexFilter onMatch="DENY" onMismatch="ACCEPT" regex=".*(update of an item which doesn't exist: undefined|error requesting channel list||Executing the JSONPATH-transformation failed|).*"/>
				<SizeBasedTriggeringPolicy size="16 MB"/>
			<DefaultRolloverStrategy max="7"/>

Please also check if logging is on at all. Easiest way via Karaf console:
from shell, use the command openhab-cli console
Default password for user openhab is habopen.
When logged in, use log:list to get a list of all configured loggers with log level.

Thanks @Udo_Hartmann - I should have included that info. It looks good to me, and events.log is populating just fine.

Logger                                             │ Level
ROOT                                               │ INFO
javax.jmdns                                        │ ERROR
javax.mail                                         │ ERROR
openhab.event                                      │ INFO
openhab.event.AddonEvent                           │ ERROR
openhab.event.ChannelDescriptionChangedEvent       │ ERROR
openhab.event.InboxUpdatedEvent                    │ ERROR
openhab.event.ItemAddedEvent                       │ ERROR
openhab.event.ItemChannelLinkAddedEvent            │ ERROR
openhab.event.ItemChannelLinkRemovedEvent          │ ERROR
openhab.event.ItemRemovedEvent                     │ ERROR
openhab.event.ItemStateEvent                       │ ERROR
openhab.event.RuleAddedEvent                       │ ERROR
openhab.event.RuleRemovedEvent                     │ ERROR
openhab.event.RuleStatusInfoEvent                  │ ERROR
openhab.event.StartlevelEvent                      │ ERROR
openhab.event.ThingAddedEvent                      │ ERROR
openhab.event.ThingRemovedEvent                    │ ERROR
openhab.event.ThingStatusInfoEvent                 │ ERROR
openhab.event.ThingUpdatedEvent                    │ ERROR
org.apache.cxf.jaxrs.sse.SseEventSinkImpl          │ ERROR
org.apache.karaf.jaas.modules.audit                │ INFO
org.apache.karaf.kar.internal.KarServiceImpl       │ ERROR                │ ERROR                     │ OFF
org.apache.sshd                                    │ WARN
org.eclipse.lsp4j                                  │ OFF
org.jupnp                                          │ ERROR
org.openhab                                        │ DEBUG
org.openhab.automation.script                      │ TRACE
org.openhab.binding.wled                           │ DEBUG
org.openhab.persistence.rrd4j                      │ TRACE
org.ops4j.pax.url.mvn.internal.AetherBasedResolver │ ERROR
org.ops4j.pax.web.pax-web-runtime                  │ OFF
su.litvak.chromecast.api.v2.Channel                │ ERROR

welp - got up this morning, confirmed issue still existed, replied to @Udo_Hartmann, took dog for a walk, and came back and added an iCal thing, and noticed logging is working again. I did change it from INFO to DEBUG…so I guess that maybe did it…and just changed rrd4j back to INFO. Maybe I was just being dumb, but I don’t think I missed anything…

Spoke too soon - openhab.log is still empty… file created on Jan 2nd but no data since then…

my log:list entries look almost identical to my other install that is working fine.

not sure what to check - tempted to do a full re-install/restore from backup but not sure that is worth it. Have lots of little things that are not working right (like iCal).

Try executing log:tail in openhab console. It shows log stream which comes from memory queue retained aside of writing to file by internal appender.

Since you haven’t shared your entire log4j xml there might be other place which is guilty. For a starter, if events log work and openhab log do not - remove all filtering from appenders in order to make sure they do not cut too much.

1 Like

ugh, thanks and thanks for the patience @splatch - trying to chase a few different issues over time during a busy period can be a challenge. At one point I restored the default log4j file and copied changes from an old backup. As I wanted to see one particular error I had removed an entry, apparently, but left the trailing ‘|’ character in ‘failed|’:

Sorry for the lousy troubleshooting and appreciate all the help. Now back to the other issue already in progress (icalendar not updating).