i am running OH3.1 and I have noticed that events.log stays emtpy but the rotation logs events.log.1 up to events.log.7 are filled. BEfore migratied from OH2, everything worked as expected.
This is a problem because frontail only monitors events.log. What have I done wrong?
What is the content of the file /var/lib/openhab/etc/log4j2.xml ?
You may try to remove the files and restart the openhab service ( sudo systemctl restart openhab )
There are reports that this helped some users.
I tried deleting events.log and restarting openhab, but the events.log is recreated but not written to.
the content of the file /var/lib/openhab/etc/log4j2.xml is:
<?xml version="1.0" encoding="UTF-8" standalone="no"?><Configuration monitorInterval="10">
<Appenders>
<!-- 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"/>
</Console>
<!-- Rolling file appender -->
<RollingFile fileName="${sys:openhab.logdir}/openhab.log" filePattern="${sys:openhab.logdir}/openhab.log.%i" name="LOGFILE">
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5.5p] [%-36.36c] - %m%n"/>
<Policies>
<OnStartupTriggeringPolicy/>
<SizeBasedTriggeringPolicy size="16 MB"/>
</Policies>
</RollingFile>
<!-- Event log appender -->
<RollingRandomAccessFile fileName="${sys:openhab.logdir}/events.log" filePattern="${sys:openhab.logdir}/events.log.%i" name="EVENT">
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5.5p] [%-36.36c] - %m%n"/>
<Policies>
<OnStartupTriggeringPolicy/>
<SizeBasedTriggeringPolicy size="16 MB"/>
</Policies>
</RollingRandomAccessFile>
<!-- Audit file appender -->
<RollingRandomAccessFile fileName="${sys:openhab.logdir}/audit.log" filePattern="${sys:openhab.logdir}/audit.log.%i" name="AUDIT">
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5.5p] [%-36.36c] - %m%n"/>
<Policies>
<OnStartupTriggeringPolicy/>
<SizeBasedTriggeringPolicy size="8 MB"/>
</Policies>
</RollingRandomAccessFile>
<!-- OSGi appender -->
<PaxOsgi filter="*" name="OSGI"/>
</Appenders>
<Loggers>
<!-- Root logger configuration -->
<Root level="WARN">
<AppenderRef ref="LOGFILE"/>
<AppenderRef ref="OSGI"/>
</Root>
<!-- Karaf Shell logger -->
<Logger level="OFF" name="org.apache.karaf.shell.support">
<AppenderRef ref="STDOUT"/>
</Logger>
<!-- Security audit logger -->
<Logger additivity="false" level="INFO" name="org.apache.karaf.jaas.modules.audit">
<AppenderRef ref="AUDIT"/>
</Logger>
<!-- openHAB specific logger configuration -->
<Logger level="INFO" name="org.openhab"/>
<Logger level="DEBUG" name="openhab.event.ItemStateEvent"/>
<Logger level="ERROR" name="openhab.event.ItemAddedEvent"/>
<Logger level="ERROR" name="openhab.event.ItemRemovedEvent"/>
<Logger level="ERROR" name="openhab.event.ItemChannelLinkAddedEvent"/>
<Logger level="ERROR" name="openhab.event.ItemChannelLinkRemovedEvent"/>
<Logger level="ERROR" name="openhab.event.ChannelDescriptionChangedEvent"/>
<Logger level="ERROR" name="openhab.event.ThingStatusInfoEvent"/>
<Logger level="ERROR" name="openhab.event.ThingAddedEvent"/>
<Logger level="ERROR" name="openhab.event.ThingUpdatedEvent"/>
<Logger level="ERROR" name="openhab.event.ThingRemovedEvent"/>
<Logger level="ERROR" name="openhab.event.InboxUpdatedEvent"/>
<Logger level="DEBUG" name="openhab.event.RuleStatusInfoEvent"/>
<Logger level="ERROR" name="openhab.event.RuleAddedEvent"/>
<Logger level="ERROR" name="openhab.event.RuleRemovedEvent"/>
<Logger level="ERROR" name="openhab.event.StartlevelEvent"/>
<Logger level="ERROR" name="openhab.event.AddonEvent"/>
<Logger additivity="false" level="DEBUG" name="openhab.event">
<AppenderRef ref="EVENT"/>
<AppenderRef ref="OSGI"/>
</Logger>
<Logger level="ERROR" name="javax.jmdns"/>
<Logger level="ERROR" name="org.jupnp"/>
<!-- This suppresses all Maven download issues from the log when doing feature installations -->
<!-- as we are logging errors ourselves in a nicer way anyhow. -->
<Logger level="ERROR" name="org.ops4j.pax.url.mvn.internal.AetherBasedResolver"/>
<!-- Filters known issues of pax-web (issue link to be added here). -->
<!-- Can be removed once the issues are resolved in an upcoming version. -->
<Logger level="OFF" name="org.ops4j.pax.web.pax-web-runtime"/>
<!-- Filters known issues of lsp4j, see -->
<!-- https://github.com/eclipse/smarthome/issues/4639 -->
<!-- https://github.com/eclipse/smarthome/issues/4629 -->
<!-- https://github.com/eclipse/smarthome/issues/4643 -->
<!-- Can be removed once the issues are resolved in an upcoming version. -->
<Logger level="OFF" name="org.eclipse.lsp4j"/>
<!-- Filters warnings for events that could not be delivered to a disconnected client. -->
<Logger level="ERROR" name="org.apache.cxf.jaxrs.sse.SseEventSinkImpl"/>
<!-- Filters known issues of KarServiceImpl, see -->
<!-- https://github.com/openhab/openhab-distro/issues/519#issuecomment-351944506 -->
<!-- Can be removed once the issues are resolved in an upcoming version. -->
<Logger level="ERROR" name="org.apache.karaf.kar.internal.KarServiceImpl"/>
<!-- Filters warnings about unavailable ciphers when JCE is not installed, see -->
<!-- https://github.com/openhab/openhab-distro/issues/999 -->
<Logger level="ERROR" name="org.apache.karaf.shell.ssh.SshUtils"/>
<!-- Filters known issues of javax.mail, see -->
<!-- https://github.com/openhab/openhab-addons/issues/5530 -->
<Logger level="ERROR" name="javax.mail"/>
<!-- Filters disconnection warnings of the ChromeCast Java API, see -->
<!-- https://github.com/openhab/openhab-addons/issues/3770 -->
<Logger level="ERROR" name="su.litvak.chromecast.api.v2.Channel"/>
<!-- Added by Karaf to prevent debug logging loops, see -->
<!-- https://issues.apache.org/jira/browse/KARAF-5559 -->
<Logger level="WARN" name="org.apache.sshd"/>
<Logger level="DEBUG" name="openhab.event.ItemStateChangedEvent"/>
<Logger level="DEBUG" name="org.openhab.core.service"/>
</Loggers>
</Configuration>
Same here, events.log is empty.
openHAB has been installed on 25th October 2021… no content…
As you see, the *.logging.cfg has the mentioned correct content, but the log is empty:
My only other suggestion would be to upgrade to the latest milestone release.
I recall also having issues with events.log but not whether this was with 3.1 only. Most of my logging issues were resolved by replacing the log4j2.xml file etc
I followed your suggestion few minutes ago.
Believe it or not, I got log files right now. Well done.
During migration of 3.1.0 to 3.2.0.M4 I recognized the following prompt for log4j2.xml, which leads to the assumptions that something important has changed (maybe not)…
I can not remember that I have added these line of code.
I have to admit that I played around with some examples from the web at the beginning of starting with openHAB in October’21. In addition I do not really know why <Logger name="openhab.event.*"/> has to be removed, that line sounds important.
Anyway, right now I get logs in events.log:
By the way, in other posts zram and frontail are mentioned as reason for this cause. This can not be case for me, both are not installed or configured. I am not using any prepared image/distribution. I use the Linux packages with apt-get (see Download openHAB | openHAB). Not the snapshot, I am not that brave enough
Edit (11 Nov 2021, 8:26am): related to the following comment by @Mark_VG , on the left-hand side 3.1.0 is shown, on the right-hand side 3.2.0.M4 is shown
Entries are written to the log4j2.xml when you make logging level changes via Karaf etc.
The ones referring to speedtest can be removed if you no longer require them.
Glad it is working for you now.
BTW: Not clear which is the current/new and which is the incorrect/old in your diff screen shots?
My file (working) has (same as the GIT source above):
I have found the cause of the problem: Within my .rules file I had a duplicate variable. Visual Studio did not inform me about this and when I started openhab, the processing of this .rules file did not throw an error, because nothing was shown in events.log.
I shut down openhab, renamed all .rules files so that they are inactive and restarted openhab. Then I enabled one rules file at a time and then the error as shown.
I wished there was a better hint at this type of problems
Thank you all for your help