Log4j 2 filters
8.5.2.4. Example - Log4j 2 filters

If a specific logger should not log into an appender, a custom IAM filter "LoggerFilter" can be used in the configuration.

log4j/all-modules.xml

<?xml version="1.0" encoding="UTF-8"?>

<Configuration name="Syslog Configuration">
	<Loggers>
		<Root level="${sys:iam.log.level}">
			<LoggerFilter onMatch="DENY" onMismatch="ACCEPT">
				<FilteredLogger name="NO_LOGS_OF_THIS_LOGGER"/>
				<FilteredLogger name="com.airlock.iam.login.app.misc.BaseServlet"/>
			</LoggerFilter>
			<AppenderRef ref="CONSOLE"/>
		</Root>
	</Loggers>
</Configuration>

This configuration filters all log messages from a custom logger NO_LOGS_OF_THIS_LOGGER and the logs from the class com.airlock.iam.login.app.misc.BaseServlet.