# Log filtering still not working after following other topics here

**URL:** <https://community.openhab.org/t/log-filtering-still-not-working-after-following-other-topics-here/121192>\
**Category:** Beginners\
**Created:** [April 21, 2021, 7:55pm UTC](https://community.openhab.org/t/log-filtering-still-not-working-after-following-other-topics-here/121192 "2021-04-21T19:55:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Depau](https://community.openhab.org/user_avatar/community.openhab.org/depau/32/67465_2.png) [@Depau](https://community.openhab.org/u/Depau)\
**Post date:** [April 21, 2021, 7:55pm UTC](https://community.openhab.org/t/log-filtering-still-not-working-after-following-other-topics-here/121192/1 "2021-04-21T19:55:34Z")

</div>

- Platform information:
  - Hardware: aarch64, ram 4GB, storage 10GB
  - OS: Docker image openhab/openhab
  - Java Runtime Environment: unchanged
  - openHAB version: openHAB 3.0.1

I have an item that pushes a PNG image over MQTT. I want to use the PNG image in a rule but I don’t want it to end up in the logs.

I tried adding to `userdata/etc/log4j2.xml` the following element, as suggested here: [Log filtering in OH 3 - #3 by markus7017](https://community.openhab.org/t/log-filtering-in-oh-3/110376/3)

```xml
<RegexFilter regex=".*Vacuum_Map.*" onMatch="DENY" onMismatch="NEUTRAL" />

```

I tried adding it to all `RollingFile` and `RollingRandomAccessFile`, and I also tried adding it to all `Loggers`, but it still logs my PNG into `openhab.log`.  
I’m pretty sure that the regex is correct but just in case, the log line I want to filter out reads like this:

```auto
2021-04-21 19:50:11.771 [INFO] [g.openhab.rule.MyRule] - {ruleUID=MyRule, 1.event=Item 'Vacuum_Map' updated to �PNG
�
IHD*v��0bKGD������� IDATx���[n�X@��b��`H�U%�ڭ���X����_O�{z�[��^���?��!T2B #T2B #T2B #T2B �{z��>=�"���>��]���{�|L]/W�z���fE #T2B #T2B #T2B #T2B �MpA�����S�{ug�������\�?��]�S�Kx+*��*��*��*��*�mz���^�8���pog��|m����kq����P��P��P��P��6=�(���O'��NW����9�_<���{���*��*��*��*��٦F��Ď�x����կ����mύ��{r��i���u1+*��*��*��*��*�mz���Hx��qXȊ
[...]

```

I also attempted editing `org.ops4j.pax.logging.cfg` as suggested here [Log4j2 Sample Config](https://community.openhab.org/t/log4j2-sample-config/33284) with no results

Current `log4j2.xml` contents:

```xml
<?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"/>
			<RegexFilter regex=".*Vacuum_Map.*" onMatch="DENY" onMismatch="NEUTRAL" />
			<!--RegexFilter regex=".*PNG.+IHD.*" onMatch="DENY" onMismatch="NEUTRAL" /-->
			<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"/>
			<RegexFilter regex=".*Vacuum_Map.*" onMatch="DENY" onMismatch="NEUTRAL" />
			<!--RegexFilter regex=".*PNG.+IHD.*" onMatch="DENY" onMismatch="NEUTRAL" /-->
			<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"/>
			<RegexFilter regex=".*Vacuum_Map.*" onMatch="DENY" onMismatch="NEUTRAL" />
			<!--RegexFilter regex=".*PNG.+IHD.*" onMatch="DENY" onMismatch="NEUTRAL" /-->
		</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"/>
			<RegexFilter regex=".*Vacuum_Map.*" onMatch="DENY" onMismatch="NEUTRAL" />
			<!--RegexFilter regex=".*PNG.+IHD.*" onMatch="DENY" onMismatch="NEUTRAL" /-->
		</Logger>

		<!-- openHAB specific logger configuration -->

		<Logger level="INFO" name="org.openhab"/>

		<Logger level="ERROR" 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.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="INFO" 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"/>
	</Loggers>

</Configuration>

```
