Activate events.log in OH3


In OH3 is a different default configuration compared to OH2.5 for the logging so that there are no entries in events.log. This configuration is located in userdata/etc/log4j2.xml.

I tried different settings in Karaf for OH 3.1.0.M2, e.g.
log:set INFO ROOT and
log:set INFO openhab.event.AddonEvent

But this seems to affect only openhab.log, but not events.log.

Could you tell me how to enable INFO for events?
Thank you.

You can try this:

And this:

Thank you Dirk,
The solutions seem to be not applicable. Both solutions talk about “smarthome” but “smarthome” is not mentioned in my log4j2.xml

Maybe you can post your log4j2.xml file so that we can compare it to a working system?


<?xml version="1.0" encoding="UTF-8" standalone="no"?><Configuration monitorInterval="10">

                <!-- 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" name="LOGFILE">
                        <PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5.5p] [%-36.36c] - %m%n"/>
                                <SizeBasedTriggeringPolicy size="16 MB"/>

                <!-- 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"/>
                                <SizeBasedTriggeringPolicy size="16 MB"/>

                <!-- 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"/>
                                <SizeBasedTriggeringPolicy size="8 MB"/>

                <!-- OSGi appender -->
                <PaxOsgi filter="*" name="OSGI"/>

                <!-- Root logger configuration -->
                <Root level="WARN">
                        <AppenderRef ref="LOGFILE"/>
                        <AppenderRef ref="OSGI"/>

                <!-- Karaf Shell logger -->
                <Logger level="OFF" name="">
                        <AppenderRef ref="STDOUT"/>

                <!-- Security audit logger -->
                <Logger additivity="false" level="INFO" name="org.apache.karaf.jaas.modules.audit">
                        <AppenderRef ref="AUDIT"/>

                <!-- 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="INFO" 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="ERROR" 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 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 -->
                <!-- -->
                <!-- -->
                <!-- -->
                <!-- 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 -->
                <!-- -->
                <!-- 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 -->
                <!-- -->
                <Logger level="ERROR" name=""/>

                <!-- Filters known issues of javax.mail, see -->
                <!-- -->
                <Logger level="ERROR" name="javax.mail"/>

                <!-- Filters disconnection warnings of the ChromeCast Java API, see -->
                <!-- -->
                <Logger level="ERROR" name="su.litvak.chromecast.api.v2.Channel"/>

                <!-- Added by Karaf to prevent debug logging loops, see -->
                <!-- -->
                <Logger level="ERROR" name="org.apache.sshd"/>
                <Logger level="TRACE" name="org.openhab.persistence.jdbc"/>

what is the content of your /var/lib/openhab/etc/org.ops4j.pax.logging.cfg file ?
Content needs to be:


Yes, I’ve the same content Wolfgang_S

I made some progress, when changing the row

<Logger level="DEBUG" name="openhab.event.ItemStateEvent"/>


<Logger level="TRACE" name="openhab.event.ItemStateEvent"/>

events.log shows the according item state events.

But unfortunately not very legible.

2021-03-07 17:02:19.178 [TRACE] [openhab.event.ItemStateEvent        ] - Received event of type 'ItemStateEvent' under the topic 'openhab/items/Solar1_Current/state' with payload: '{"type":"Decimal","value":"0.094"}'
2021-03-07 17:02:19.179 [TRACE] [openhab.event.ItemStateEvent        ] - Received event of type 'ItemStateEvent' under the topic 'openhab/items/Solar1_Power/state' with payload: '{"type":"Decimal","value":"12"}'
2021-03-07 17:02:19.180 [TRACE] [openhab.event.ItemStateEvent        ] - Received event of type 'ItemStateEvent' under the topic 'openhab/items/Solar1_Voltage/state' with payload: '{"type":"Decimal","value":"230"}'

I would prefer to have the same style we had in OH2.5 events.log, e.g.

2021-03-07 17:04:19.181 [vent.ItemStateChangedEvent] - Solar1_Power changed from 11 to 10
2021-03-07 17:04:19.182 [vent.ItemStateChangedEvent] - Solar1_Voltage changed from 229 to 230
2021-03-07 17:04:19.182 [vent.ItemStateChangedEvent] - Solar1_Current changed from 0.091 to 0.08
2021-03-07 17:04:42.476 [vent.ItemStateChangedEvent] - MHIACCtrl_OutdoorTemperature changed from 8.2 to 8.0

I assume it is related to the “smarthome” entries in OH2.5 org.ops4j.pax.logging.cfg, but my trials using these “smarthome” entries in log4j2.xml had no effect. Not sure if “smarthome” still exists in OH3.

I would appreciate further ideas.

smarthome is changed to openhab in OH3.