After new logfile configuration added events.log is not filled anymore

Hi,
I am running openHAB 4.1.2 on RaspberryPi 4 Model B from USB Drive.
Since I am adding lots of rules to the system I want to keep messages that I generate in the system seperately and created a file called “/var/log/openhab/myopenhablog.log”
When I did not have the lo4j2.xml file configured the event logging procedure worked fine for me as it was writing to the events log.
Here is the code I am using which worked fine:

import org.slf4j.Logger
import org.slf4j.LoggerFactory

val Logger myLogger = LoggerFactory.getLogger("org.openhab.rule.myopenhablog")

Then I started to configure the log4j2.xml file and added some sections. Here is the complete file (I added a new fileappender and a logger configuration):

<?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.gz" 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>
            <DefaultRolloverStrategy max="7"/>
        </RollingFile>

        <!-- Event log appender -->
        <RollingRandomAccessFile fileName="${sys:openhab.logdir}/events.log" filePattern="${sys:openhab.logdir}/events.log.%i.gz" 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>
            <DefaultRolloverStrategy max="7"/>
        </RollingRandomAccessFile>

        <!-- Audit file appender -->
        <RollingRandomAccessFile fileName="${sys:openhab.logdir}/audit.log" filePattern="${sys:openhab.logdir}/audit.log.%i.gz" 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>
            <DefaultRolloverStrategy max="7"/>
        </RollingRandomAccessFile>

        <!-- Custom appender for myopenhablog.log -->
        <RollingRandomAccessFile filename="${sys:openhab.logdir}myopenhablog" filePattern="/var/log/openhab/myopenhablog-%d{yyyy-MM-dd}.log" name="myopenhablog">
            <PatternLayout pattern>="%d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %-5level %logger{36} - %m%n"</n>
            </PatternLayout>
            <Policies>
                <TimeBasedTriggeringPolicy interval="1" modulate="true"/>
                <SizeBasedTriggeringPolicy size="10MB"/>
            </Policies>
            <DefaultRolloverStrategy max="7"/>
        </RollingFile>

        <!-- 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>

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

        <!-- Event logger -->
        <Logger additivity="false" level="INFO" name="smarthome.event">
            <AppenderRef ref="EVENT"/>
        </Logger>

        <Logger level="ERROR" name="smarthome.event.InboxUpdatedEvent"/>
        <Logger level="ERROR" name="smarthome.event.RuleStatusInfoEvent"/>
        <Logger level="ERROR" name="smarthome.event.ItemAddedEvent"/>
        <Logger level="ERROR" name="smarthome.event.ItemRemovedEvent"/>
        <Logger level="ERROR" name="smarthome.event.ThingAddedEvent"/>
        <Logger level="ERROR" name="smarthome.event.ThingUpdatedEvent"/>
        <Logger level="ERROR" name="smarthome.event.ThingRemovedEvent"/>
        <Logger level="ERROR" name="smarthome.event.InboxRemovedEvent"/>

        <!-- 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.apache.karaf.features.internal.download.impl.AbstractRetryableDownloadTask"/>

        <!-- Custom logger for myopenhablog -->
        <Logger name="org.openhab.rule.myopenhablog" level="INFO" additivity="false">
            <AppenderRef ref="myopenhablog"/>
        </Logger>

        <!-- 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 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"/>

        <!-- 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 warnings from broken connections during startup -->
        <!-- https://github.com/openhab/openhab-core/issues/2998 -->
        <Logger level="ERROR" name="org.apache.cxf.phase.PhaseInterceptorChain"/>

        <!-- 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"/>

    </Loggers>

</Configuration>

Since I changed the configuration no events are written any more to the events.log file, nor do my own events be written to my own logfile.

Looks like something is interfering in the configuration, but I don’t find it yet and ask for help!

Your XML is not valid. Every starting tag needs a matching ending tag. Your myopenhablo.log appender opening tag is <RollingRandomAccessFile... but the closing tag is </RollingFile>. This renders the whole XML file invalid.

Oh dear! You’re right! Didn’t see this @rlkoshak - will correct it and see if it works, but I have no doubts!
Thanks man!