Log4j2Appender installFilter(Log4j2Appender appender) { appender.addFilter(new AbstractFilter() { @Override public Result filter(final LogEvent event) { // To prevent infinite looping, we filter out events from // the publishing thread Result decision = Result.NEUTRAL; if (LoggingEventCache.PUBLISH_THREAD_NAME.equals(event.getThreadName())) { decision = Result.DENY; } return decision; }}); return appender; }