Untamed event log

At one time I thought I had my event log tamed, but it’s full of junk again. Trying to clean it up, I made it worse. Now, none of these filters seem to be working at all. (I’m running 2.5.2 Release Build on Windows.)

I have the following in c:\openhab2\userdata\etc\org.ops4j.pax.logging.cfg:

# Event log appender
log4j2.appender.event.type = RollingRandomAccessFile
log4j2.appender.event.name = EVENT
log4j2.appender.event.fileName = ${openhab.logdir}/events.log
log4j2.appender.event.filePattern = ${openhab.logdir}/events.log.%i
log4j2.appender.event.immediateFlush = true
log4j2.appender.event.append = true
log4j2.appender.event.layout.type = PatternLayout
log4j2.appender.event.layout.pattern = %d{yyyy-MM-dd HH:mm:ss.SSS} [%-26.26c] - %m%n
log4j2.appender.event.policies.type = Policies
log4j2.appender.event.policies.size.type = SizeBasedTriggeringPolicy
log4j2.appender.event.policies.size.size = 16MB

# Suppressing the noise from the 5-second updates from the ACP UPS
log4j2.appender.event.filter.apcjunk.type = RegexFilter
log4j2.appender.event.filter.apcjunk.regex = .*(APC_Raw|APC_DATE|APC_LOADPCT|APC_TIMELEFT|APC_LINEV|APC_BATTV).*
log4j2.appender.event.filter.apcjunk.onMatch = DENY
log4j2.appender.event.filter.apcjunk.onMisMatch = NEUTRAL

# Suppressing the noise from Astro sun and moon elevation changes, and NTP Time
log4j2.appender.event.filter.astroelevation.type = RegexFilter
log4j2.appender.event.filter.astroelevation.regex = .*(CurrentDateTime|Date changed from|Elevation).*
log4j2.appender.event.filter.astroelevation.onMatch = DENY
log4j2.appender.event.filter.astroelevation.onMisMatch = NEUTRAL

# Suppressing the noise from presence tracking ... TODO: need to send this to a different log if possible
log4j2.appender.event.filter.presence.type = RegexFilter
log4j2.appender.event.filter.presence.regex = .*Presence_.*
log4j2.appender.event.filter.presence.onMatch = DENY
log4j2.appender.event.filter.presence.onMisMatch = NEUTRAL

Should I be using C:\openhab2\userdata\config\org\ops4j\pax\logging.config? Where have I gone wrong?

Found my answer here. The secret is to define a filter attribute, and filters to it.

Thanks @rpwong!

The edited version of the above now works.

# Event log filters
#
# custom filters for events.log
log4j2.appender.event.filter.lognoise.type = Filters
#
# Supressing the noise from the 5-second updates from the ACP UPS
log4j2.appender.event.filter.lognoise.apcjunk.type = RegexFilter
log4j2.appender.event.filter.lognoise.apcjunk.regex = .*(APC_Raw|APC_DATE|APC_LOADPCT|APC_TIMELEFT|APC_LINEV|APC_BATTV).*
log4j2.appender.event.filter.lognoise.apcjunk.onMatch = DENY
log4j2.appender.event.filter.lognoise.apcjunk.onMisMatch = NEUTRAL
#
# Supressing the noise from Astro sun and moon elevation changes, and NTP Time
log4j2.appender.event.filter.lognoise.astroelevation.type = RegexFilter
log4j2.appender.event.filter.lognoise.astroelevation.regex = .*(CurrentDateTime|Date changed from|Elevation).*
log4j2.appender.event.filter.lognoise.astroelevation.onMatch = DENY
log4j2.appender.event.filter.lognoise.astroelevation.onMisMatch = NEUTRAL
#
# Supressing the noise from presence tracking ... TODO: need to send this to a different log if possible
log4j2.appender.event.filter.lognoise.presence.type = RegexFilter
log4j2.appender.event.filter.lognoise.presence.regex = .*Presence_.*
log4j2.appender.event.filter.lognoise.presence.onMatch = DENY
log4j2.appender.event.filter.lognoise.presence.onMisMatch = NEUTRAL