You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@knox.apache.org by sm...@apache.org on 2021/11/17 16:33:21 UTC

[knox] branch master updated: KNOX-1462 - Migrate from Log4j 1.x to 2.x (#488)

This is an automated email from the ASF dual-hosted git repository.

smolnar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/knox.git


The following commit(s) were added to refs/heads/master by this push:
     new cd88493  KNOX-1462 - Migrate from Log4j 1.x to 2.x (#488)
cd88493 is described below

commit cd8849314b5d2a516d353554f9a1d140a36a58cb
Author: Attila Magyar <m....@gmail.com>
AuthorDate: Wed Nov 17 17:33:15 2021 +0100

    KNOX-1462 - Migrate from Log4j 1.x to 2.x (#488)
---
 .../gateway/audit/log4j/layout/AuditLayout.java    |  4 +-
 .../src/main/resources/META-INF/launcher.cfg       |  2 +-
 .../src/main/resources/META-INF/launcher.cfg       |  2 +-
 gateway-demo-ldap/pom.xml                          | 14 +---
 .../security/ldap/SimpleLdapDirectoryServer.java   |  9 +-
 .../src/main/resources/log4j.properties            | 25 ------
 gateway-demo-ldap/src/main/resources/log4j2.xml    | 29 +++++++
 gateway-i18n-logging-log4j/pom.xml                 |  8 +-
 .../messages/loggers/log4j/Log4jMessageLogger.java | 43 ++--------
 .../loggers/log4j/Log4jMessageLoggerFactory.java   |  4 +-
 gateway-performance-test/pom.xml                   |  2 +-
 .../resources/performanceTest-log4j.properties     | 35 --------
 .../src/test/resources/performanceTest-log4j2.xml  | 42 ++++++++++
 .../provider/impl/HS2ZookeeperURLManagerTest.java  |  1 +
 .../filter/AbstractIdentityAssertionFilter.java    |  5 +-
 gateway-provider-rewrite/pom.xml                   |  8 +-
 .../api/UrlRewriteRulesDescriptorFactoryTest.java  | 13 +--
 .../rewrite/api/UrlRewriteServletFilterTest.java   | 68 +++++++--------
 .../src/test/resources/log4j.properties            | 37 --------
 .../src/test/resources/log4j2.xml                  | 40 +++++++++
 .../knox/gateway/filter/AnonymousAuthFilter.java   |  5 +-
 gateway-provider-security-hadoopauth/pom.xml       |  5 ++
 .../hadoopauth/filter/HadoopAuthPostFilter.java    |  5 +-
 gateway-provider-security-jwt/pom.xml              |  5 --
 .../federation/jwt/filter/AbstractJWTFilter.java   |  1 +
 gateway-provider-security-pac4j/pom.xml            | 16 +++-
 .../gateway/pac4j/filter/Pac4jIdentityAdapter.java | 12 ++-
 .../gateway/pac4j/session/KnoxSessionStore.java    |  6 +-
 .../filter/AbstractPreAuthFederationFilter.java    |  5 +-
 .../filter/ShiroSubjectIdentityAdapter.java        |  5 +-
 gateway-release-common/home/bin/knox-env.sh        |  8 +-
 gateway-release/home/conf/gateway-log4j.properties | 85 -------------------
 gateway-release/home/conf/gateway-log4j2.xml       | 82 ++++++++++++++++++
 gateway-release/home/conf/knoxcli-log4j.properties | 34 --------
 gateway-release/home/conf/knoxcli-log4j2.xml       | 38 +++++++++
 gateway-release/home/conf/ldap-log4j.properties    | 32 -------
 gateway-release/home/conf/ldap-log4j2.xml          | 39 +++++++++
 gateway-release/home/conf/shell-log4j.properties   | 33 --------
 gateway-release/home/conf/shell-log4j2.xml         | 37 ++++++++
 .../src/main/resources/META-INF/launcher.cfg       |  2 +-
 gateway-server/pom.xml                             | 12 ++-
 .../org/apache/knox/gateway/GatewayFilter.java     | 58 ++++++-------
 .../org/apache/knox/gateway/GatewayServer.java     | 20 -----
 .../knox/gateway/filter/CorrelationHandler.java    | 20 ++---
 .../apache/knox/gateway/trace/AccessHandler.java   |  5 +-
 .../org/apache/knox/gateway/trace/TraceInput.java  |  7 +-
 .../org/apache/knox/gateway/trace/TraceOutput.java |  7 +-
 .../apache/knox/gateway/trace/TraceRequest.java    |  7 +-
 .../apache/knox/gateway/trace/TraceResponse.java   |  8 +-
 .../java/org/apache/knox/gateway/util/KnoxCLI.java |  2 -
 .../src/main/resources/conf/log4j.properties       | 24 ------
 gateway-server/src/main/resources/conf/log4j2.xml  | 36 ++++++++
 .../org/apache/knox/gateway/AuditLoggingTest.java  | 81 +++++++++---------
 .../xml/XmlGatewayDescriptorImporterTest.java      |  7 +-
 .../builder/PropertyTopologyBuilderTest.java       | 19 -----
 gateway-server/src/test/resources/log4j.properties | 35 --------
 gateway-server/src/test/resources/log4j2-test.xml  | 33 ++++++++
 .../src/test/resources/logging.properties          | 87 -------------------
 .../src/test/resources/log4j.properties            | 24 ------
 .../src/test/resources/log4j2.xml                  | 29 +++++++
 gateway-service-nifi-registry/pom.xml              |  5 --
 gateway-service-nifi/pom.xml                       |  4 +-
 .../knox/gateway/dispatch/NiFiRequestUtil.java     |  4 +-
 ...ConfigurationRegistryClientServiceTestBase.java |  1 -
 .../src/main/resources/META-INF/launcher.cfg       |  2 +-
 gateway-shell-release/home/bin/knoxshell.sh        |  2 +-
 .../home/conf/knoxshell-log4j.properties           | 35 --------
 .../home/conf/knoxshell-log4j2.xml                 | 41 +++++++++
 gateway-shell/pom.xml                              |  4 -
 .../java/org/apache/knox/gateway/shell/Shell.java  |  2 -
 gateway-test-release-utils/pom.xml                 |  4 +-
 .../org/apache/knox/gateway/GatewayTestDriver.java |  6 +-
 gateway-test-release/pom.xml                       | 48 +++++++++--
 .../org/apache/knox/gateway/SecureClusterTest.java |  6 --
 .../apache/knox/gateway/SecureKnoxShellTest.java   | 17 +---
 .../java/org/apache/knox/gateway/ShellTest.java    |  6 --
 gateway-test-utils/pom.xml                         |  8 +-
 .../main/java/org/apache/knox/test/TestUtils.java  |  5 +-
 .../org/apache/knox/test/log/CollectAppender.java  | 46 +++++-----
 .../org/apache/knox/test/log/NoOpAppender.java     | 98 ----------------------
 .../java/org/apache/knox/test/mock/MockServer.java |  6 +-
 .../org/apache/knox/test/mock/MockServlet.java     |  6 +-
 gateway-test/pom.xml                               |  9 +-
 .../knox/gateway/AmbariServiceDefinitionTest.java  |  6 +-
 .../apache/knox/gateway/GatewayAdminFuncTest.java  |  6 +-
 .../knox/gateway/GatewayAdminTopologyFuncTest.java |  6 +-
 .../apache/knox/gateway/GatewayAppFuncTest.java    |  6 +-
 .../apache/knox/gateway/GatewayBasicFuncTest.java  |  8 +-
 .../knox/gateway/GatewayCorrelationIdTest.java     | 16 ++--
 .../apache/knox/gateway/GatewayDeployFuncTest.java |  6 +-
 .../apache/knox/gateway/GatewayHealthFuncTest.java |  6 +-
 .../knox/gateway/GatewayLocalServiceFuncTest.java  | 12 +--
 .../apache/knox/gateway/GatewayMultiFuncTest.java  |  6 +-
 .../apache/knox/gateway/GatewaySampleFuncTest.java |  6 +-
 .../apache/knox/gateway/GatewaySslFuncTest.java    |  6 +-
 .../org/apache/knox/gateway/Knox242FuncTest.java   |  1 -
 .../knox/gateway/KnoxCliLdapFuncTestNegative.java  | 10 +--
 .../knox/gateway/KnoxCliLdapFuncTestPositive.java  | 16 +---
 .../apache/knox/gateway/KnoxCliSysBindTest.java    | 10 +--
 .../gateway/deploy/DeploymentFactoryFuncTest.java  |  6 --
 gateway-test/src/test/resources/log4j.properties   | 44 ----------
 gateway-test/src/test/resources/log4j2.xml         | 48 +++++++++++
 gateway-util-common/pom.xml                        | 13 ++-
 .../knox/gateway/audit/api/CorrelationContext.java | 31 -------
 .../knox/gateway/audit/api/CorrelationService.java | 17 +---
 .../appender/JdbmStoreAndForwardAppender.java      | 93 ++++++++++----------
 .../audit/log4j/audit/Log4jAuditContext.java       | 37 ++++++--
 .../audit/log4j/audit/Log4jAuditService.java       | 61 +++++++++-----
 .../gateway/audit/log4j/audit/Log4jAuditor.java    | 35 ++++----
 .../log4j/correlation/Log4jCorrelationContext.java | 73 ++++++----------
 .../log4j/correlation/Log4jCorrelationService.java | 58 ++++++-------
 .../gateway/audit/log4j/layout/AuditLayout.java    | 74 ++++++++++------
 .../apache/knox/gateway/audit/AuditLayoutTest.java | 62 +++++++-------
 .../knox/gateway/audit/AuditServiceTest.java       | 78 +++++++++--------
 .../apache/knox/gateway/audit/JdbmQueueTest.java   |  4 -
 .../gateway/audit/StoreAndForwardAppenderTest.java | 14 ++--
 .../src/test/resources/audit-log4j.properties      | 25 ------
 .../src/test/resources/log4j2-test.xml             | 37 ++++++++
 .../src/main/resources/META-INF/launcher.cfg       |  2 +-
 pom.xml                                            | 82 ++++++++++++++----
 120 files changed, 1293 insertions(+), 1460 deletions(-)

diff --git a/gateway-adapter/src/main/java/org/apache/hadoop/gateway/audit/log4j/layout/AuditLayout.java b/gateway-adapter/src/main/java/org/apache/hadoop/gateway/audit/log4j/layout/AuditLayout.java
index 44d8b5a..d88386c 100644
--- a/gateway-adapter/src/main/java/org/apache/hadoop/gateway/audit/log4j/layout/AuditLayout.java
+++ b/gateway-adapter/src/main/java/org/apache/hadoop/gateway/audit/log4j/layout/AuditLayout.java
@@ -16,6 +16,8 @@
  */
 package org.apache.hadoop.gateway.audit.log4j.layout;
 
+import java.nio.charset.StandardCharsets;
+
 /**
  * An adapter class that delegate calls to {@link org.apache.knox.gateway.audit.log4j.layout.AuditLayout}
  * for backwards compatibility with package structure.
@@ -29,6 +31,6 @@ public class AuditLayout extends org.apache.knox.gateway.audit.log4j.layout.Audi
    * Create an instance
    */
   public AuditLayout() {
-    super();
+    super(StandardCharsets.UTF_8);
   }
 }
diff --git a/gateway-adapter/src/main/resources/META-INF/launcher.cfg b/gateway-adapter/src/main/resources/META-INF/launcher.cfg
index 35b32f3..a9ffee5 100644
--- a/gateway-adapter/src/main/resources/META-INF/launcher.cfg
+++ b/gateway-adapter/src/main/resources/META-INF/launcher.cfg
@@ -14,4 +14,4 @@
 # limitations under the License.
 main.class = org.apache.knox.gateway.security.ldap.SimpleLdapDirectoryServer
 class.path = ../lib/*.jar;../dep/*.jar;../ext;../ext/*.jar
-log4j.configuration=${launcher.dir}/../conf/${launcher.name}-log4j.properties
+log4j.configurationFile=${launcher.dir}/../conf/${launcher.name}-log4j2.xml
diff --git a/gateway-demo-ldap-launcher/src/main/resources/META-INF/launcher.cfg b/gateway-demo-ldap-launcher/src/main/resources/META-INF/launcher.cfg
index 35b32f3..a9ffee5 100644
--- a/gateway-demo-ldap-launcher/src/main/resources/META-INF/launcher.cfg
+++ b/gateway-demo-ldap-launcher/src/main/resources/META-INF/launcher.cfg
@@ -14,4 +14,4 @@
 # limitations under the License.
 main.class = org.apache.knox.gateway.security.ldap.SimpleLdapDirectoryServer
 class.path = ../lib/*.jar;../dep/*.jar;../ext;../ext/*.jar
-log4j.configuration=${launcher.dir}/../conf/${launcher.name}-log4j.properties
+log4j.configurationFile=${launcher.dir}/../conf/${launcher.name}-log4j2.xml
diff --git a/gateway-demo-ldap/pom.xml b/gateway-demo-ldap/pom.xml
index 663985d..71f10d2 100644
--- a/gateway-demo-ldap/pom.xml
+++ b/gateway-demo-ldap/pom.xml
@@ -74,18 +74,8 @@
         </dependency>
 
         <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-api</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-log4j12</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>log4j</groupId>
-            <artifactId>log4j</artifactId>
+            <groupId>org.apache.logging.log4j</groupId>
+            <artifactId>log4j-api</artifactId>
         </dependency>
 
         <dependency>
diff --git a/gateway-demo-ldap/src/main/java/org/apache/knox/gateway/security/ldap/SimpleLdapDirectoryServer.java b/gateway-demo-ldap/src/main/java/org/apache/knox/gateway/security/ldap/SimpleLdapDirectoryServer.java
index 6e17c99..1561e32 100644
--- a/gateway-demo-ldap/src/main/java/org/apache/knox/gateway/security/ldap/SimpleLdapDirectoryServer.java
+++ b/gateway-demo-ldap/src/main/java/org/apache/knox/gateway/security/ldap/SimpleLdapDirectoryServer.java
@@ -33,9 +33,8 @@ import org.apache.directory.server.ldap.LdapServer;
 import org.apache.directory.server.protocol.shared.store.LdifFileLoader;
 import org.apache.directory.server.protocol.shared.transport.TcpTransport;
 import org.apache.directory.server.protocol.shared.transport.Transport;
-import org.apache.log4j.PropertyConfigurator;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 
 import java.io.File;
 import java.io.FileNotFoundException;
@@ -44,7 +43,7 @@ import java.util.UUID;
 
 public class SimpleLdapDirectoryServer {
 
-  private static final Logger LOG = LoggerFactory.getLogger(SimpleLdapDirectoryServer.class);
+  private static final Logger LOG = LogManager.getLogger(SimpleLdapDirectoryServer.class);
 
   private static final String DEFAULT_PORT = "33389";
 
@@ -128,8 +127,6 @@ public class SimpleLdapDirectoryServer {
   }
 
   public static void main( String[] args ) throws Exception {
-    PropertyConfigurator.configure( System.getProperty( "log4j.configuration" ) );
-
     SimpleLdapDirectoryServer ldap;
 
     File file;
diff --git a/gateway-demo-ldap/src/main/resources/log4j.properties b/gateway-demo-ldap/src/main/resources/log4j.properties
deleted file mode 100644
index 529380f..0000000
--- a/gateway-demo-ldap/src/main/resources/log4j.properties
+++ /dev/null
@@ -1,25 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-log4j.rootLogger=ERROR,stdout
-log4j.threshhold=ALL
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} %-5p %m%n
-
-#log4j.logger.org.apache.directory=INFO
-#log4j.logger.org.apache.knox.gateway=INFO
-#log4j.logger.org.apache.knox.gateway=DEBUG
\ No newline at end of file
diff --git a/gateway-demo-ldap/src/main/resources/log4j2.xml b/gateway-demo-ldap/src/main/resources/log4j2.xml
new file mode 100644
index 0000000..c3f84a5
--- /dev/null
+++ b/gateway-demo-ldap/src/main/resources/log4j2.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<Configuration>
+    <Appenders>
+        <Console name="stdout" target="SYSTEM_OUT">
+            <PatternLayout pattern="%d{ISO8601} %-5p %m%n" />
+        </Console>
+    </Appenders>
+    <Loggers>
+        <Root level="error">
+            <AppenderRef ref="stdout"/>
+        </Root>
+    </Loggers>
+</Configuration>
diff --git a/gateway-i18n-logging-log4j/pom.xml b/gateway-i18n-logging-log4j/pom.xml
index 3d40233..c8c8c39 100644
--- a/gateway-i18n-logging-log4j/pom.xml
+++ b/gateway-i18n-logging-log4j/pom.xml
@@ -31,8 +31,12 @@
 
     <dependencies>
         <dependency>
-            <groupId>log4j</groupId>
-            <artifactId>log4j</artifactId>
+            <groupId>org.apache.logging.log4j</groupId>
+            <artifactId>log4j-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.logging.log4j</groupId>
+            <artifactId>log4j-core</artifactId>
         </dependency>
 
         <dependency>
diff --git a/gateway-i18n-logging-log4j/src/main/java/org/apache/knox/gateway/i18n/messages/loggers/log4j/Log4jMessageLogger.java b/gateway-i18n-logging-log4j/src/main/java/org/apache/knox/gateway/i18n/messages/loggers/log4j/Log4jMessageLogger.java
index c8b42dc..cae68ea 100644
--- a/gateway-i18n-logging-log4j/src/main/java/org/apache/knox/gateway/i18n/messages/loggers/log4j/Log4jMessageLogger.java
+++ b/gateway-i18n-logging-log4j/src/main/java/org/apache/knox/gateway/i18n/messages/loggers/log4j/Log4jMessageLogger.java
@@ -19,16 +19,12 @@ package org.apache.knox.gateway.i18n.messages.loggers.log4j;
 
 import org.apache.knox.gateway.i18n.messages.MessageLevel;
 import org.apache.knox.gateway.i18n.messages.MessageLogger;
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-import org.apache.log4j.spi.LocationInfo;
-import org.apache.log4j.spi.LoggingEvent;
-import org.apache.log4j.spi.ThrowableInformation;
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.message.SimpleMessage;
 
 public class Log4jMessageLogger implements MessageLogger {
-
   private static String CLASS_NAME = Log4jMessageLogger.class.getName();
-
   private Logger logger;
 
   Log4jMessageLogger( Logger logger ) {
@@ -37,42 +33,15 @@ public class Log4jMessageLogger implements MessageLogger {
 
   @Override
   public final boolean isLoggable( final MessageLevel level ) {
-    return logger.isEnabledFor( toLevel( level ) );
+    return logger.isEnabled( toLevel( level ) );
   }
 
   @Override
   public final void log( final StackTraceElement caller, final MessageLevel messageLevel, final String messageId, final String messageText, final Throwable thrown ) {
-    LoggingEvent event = new LoggingEvent(
-        /* String fqnOfCategoryClass */ CLASS_NAME,
-        /* Category logger */ logger,
-        /* long timeStamp */ System.currentTimeMillis(),
-        /* Level level */ toLevel( messageLevel ),
-        /* Object message */ messageText,
-        /* String threadName */ Thread.currentThread().getName(),
-        /* ThrowableInformation throwable */ toThrownInformation( thrown ),
-        /* String ndc */ null,
-        /* LocationInfo info */ toLocationInfo( caller ),
-        /* java.util.Map properties */ null );
-    logger.callAppenders( event );
-  }
-
-  private static ThrowableInformation toThrownInformation( final Throwable thrown ) {
-    ThrowableInformation info = null;
-    if( thrown != null ) {
-      info = new ThrowableInformation( thrown );
-    }
-    return info;
-  }
-
-  private static LocationInfo toLocationInfo( final StackTraceElement caller ) {
-    LocationInfo info = null;
-    if( caller != null ) {
-        info = new LocationInfo( caller.getFileName(), caller.getClassName(), caller.getMethodName(), Integer.toString(caller.getLineNumber()) );
-    }
-    return info;
+    logger.logMessage(toLevel(messageLevel), null, CLASS_NAME, caller, new SimpleMessage(messageText), thrown);
   }
 
-  private static Level toLevel( final MessageLevel level ) {
+  private static Level toLevel(final MessageLevel level ) {
     switch( level ) {
       case FATAL: return Level.FATAL;
       case ERROR: return Level.ERROR;
diff --git a/gateway-i18n-logging-log4j/src/main/java/org/apache/knox/gateway/i18n/messages/loggers/log4j/Log4jMessageLoggerFactory.java b/gateway-i18n-logging-log4j/src/main/java/org/apache/knox/gateway/i18n/messages/loggers/log4j/Log4jMessageLoggerFactory.java
index fc9f015..9b44d15 100644
--- a/gateway-i18n-logging-log4j/src/main/java/org/apache/knox/gateway/i18n/messages/loggers/log4j/Log4jMessageLoggerFactory.java
+++ b/gateway-i18n-logging-log4j/src/main/java/org/apache/knox/gateway/i18n/messages/loggers/log4j/Log4jMessageLoggerFactory.java
@@ -19,13 +19,13 @@ package org.apache.knox.gateway.i18n.messages.loggers.log4j;
 
 import org.apache.knox.gateway.i18n.messages.MessageLogger;
 import org.apache.knox.gateway.i18n.messages.MessageLoggerFactory;
-import org.apache.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
 
 public class Log4jMessageLoggerFactory implements MessageLoggerFactory {
 
   @Override
   public MessageLogger getLogger( String name ) {
-    return new Log4jMessageLogger( Logger.getLogger( name ) );
+    return new Log4jMessageLogger( LogManager.getLogger( name ) );
   }
 
 }
diff --git a/gateway-performance-test/pom.xml b/gateway-performance-test/pom.xml
index 474bb4f..ae2df0b 100644
--- a/gateway-performance-test/pom.xml
+++ b/gateway-performance-test/pom.xml
@@ -112,7 +112,7 @@
                                         </systemProperty>
                                         <systemProperty>
                                             <key>log4j.configuration</key>
-                                            <value>file:${basedir}/src/test/resources/performanceTest-log4j.properties</value>
+                                            <value>file:${basedir}/src/test/resources/performanceTest-log4j2.xml</value>
                                         </systemProperty>
                                     </systemProperties>
                                 </configuration>
diff --git a/gateway-performance-test/src/test/resources/performanceTest-log4j.properties b/gateway-performance-test/src/test/resources/performanceTest-log4j.properties
deleted file mode 100644
index 3fa6534..0000000
--- a/gateway-performance-test/src/test/resources/performanceTest-log4j.properties
+++ /dev/null
@@ -1,35 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-app.log.dir=gateway-performance-test/target/logs
-app.log.file=performanceTest.log
-
-log4j.rootLogger=ERROR, stdout, drfa
-
-log4j.logger.org.apache.knox.gateway.performance.test=INFO
-log4j.logger.org.apache.http.client=INFO
-log4j.logger.org.apache.http.impl.client=INFO
-log4j.logger.org.apache.http.impl.conn=INFO
-
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} - [%t] - %m%n
-
-log4j.appender.drfa=org.apache.log4j.DailyRollingFileAppender
-log4j.appender.drfa.File=${app.log.dir}/${app.log.file}
-log4j.appender.drfa.DatePattern=.yyyy-MM-dd
-log4j.appender.drfa.layout=org.apache.log4j.PatternLayout
-log4j.appender.drfa.layout.ConversionPattern=%d{ISO8601} - [%t] - %m%n
diff --git a/gateway-performance-test/src/test/resources/performanceTest-log4j2.xml b/gateway-performance-test/src/test/resources/performanceTest-log4j2.xml
new file mode 100644
index 0000000..2193aa6
--- /dev/null
+++ b/gateway-performance-test/src/test/resources/performanceTest-log4j2.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<Configuration>
+    <Properties>
+        <Property name="app.log.dir">gateway-performance-test/target/logs</Property>
+        <Property name="app.log.file">performanceTest.log</Property>
+    </Properties>
+    <Appenders>
+        <Console name="stdout" target="SYSTEM_OUT">
+            <PatternLayout pattern="%d{ISO8601} - [%t] - %m%n" />
+        </Console>
+        <RollingFile name="drfa" fileName="${app.log.dir}/${app.log.file}" filePattern="${app.log.dir}/${app.log.file}.%d{yyyy-MM-dd}">
+            <PatternLayout pattern="%d{ISO8601} - [%t] - %m%n" />
+            <TimeBasedTriggeringPolicy />
+        </RollingFile>
+    </Appenders>
+    <Loggers>
+        <Logger name="org.apache.http.impl.client" level="INFO" />
+        <Logger name="org.apache.http.client" level="INFO" />
+        <Logger name="org.apache.knox.gateway.performance.test" level="INFO" />
+        <Logger name="org.apache.http.impl.conn" level="INFO" />
+        <Logger level="ERROR">
+            <AppenderRef ref="stdout" />
+            <AppenderRef ref="drfa" />
+        </Logger>
+    </Loggers>
+</Configuration>
diff --git a/gateway-provider-ha/src/test/java/org/apache/knox/gateway/ha/provider/impl/HS2ZookeeperURLManagerTest.java b/gateway-provider-ha/src/test/java/org/apache/knox/gateway/ha/provider/impl/HS2ZookeeperURLManagerTest.java
index 00b736f..00dc482 100644
--- a/gateway-provider-ha/src/test/java/org/apache/knox/gateway/ha/provider/impl/HS2ZookeeperURLManagerTest.java
+++ b/gateway-provider-ha/src/test/java/org/apache/knox/gateway/ha/provider/impl/HS2ZookeeperURLManagerTest.java
@@ -43,6 +43,7 @@ public class HS2ZookeeperURLManagerTest {
 
   @Before
   public void setUp() throws Exception {
+    System.setProperty("zookeeper.jmx.log4j.disable", "true");
     cluster = new TestingCluster(1);
     cluster.start();
 
diff --git a/gateway-provider-identity-assertion-common/src/main/java/org/apache/knox/gateway/identityasserter/common/filter/AbstractIdentityAssertionFilter.java b/gateway-provider-identity-assertion-common/src/main/java/org/apache/knox/gateway/identityasserter/common/filter/AbstractIdentityAssertionFilter.java
index c210128..b18023b 100644
--- a/gateway-provider-identity-assertion-common/src/main/java/org/apache/knox/gateway/identityasserter/common/filter/AbstractIdentityAssertionFilter.java
+++ b/gateway-provider-identity-assertion-common/src/main/java/org/apache/knox/gateway/identityasserter/common/filter/AbstractIdentityAssertionFilter.java
@@ -37,6 +37,7 @@ import javax.servlet.http.HttpServletRequestWrapper;
 import org.apache.knox.gateway.IdentityAsserterMessages;
 import org.apache.knox.gateway.audit.api.Action;
 import org.apache.knox.gateway.audit.api.ActionOutcome;
+import org.apache.knox.gateway.audit.api.AuditContext;
 import org.apache.knox.gateway.audit.api.AuditService;
 import org.apache.knox.gateway.audit.api.AuditServiceFactory;
 import org.apache.knox.gateway.audit.api.Auditor;
@@ -110,7 +111,9 @@ public abstract class AbstractIdentityAssertionFilter extends
         if (primaryPrincipal != null) {
           if (!primaryPrincipal.getName().equals(mappedPrincipalName)) {
             impersonationNeeded = true;
-            auditService.getContext().setProxyUsername( mappedPrincipalName );
+            AuditContext context = auditService.getContext();
+            context.setProxyUsername( mappedPrincipalName );
+            auditService.attachContext(context);
             auditor.audit( Action.IDENTITY_MAPPING, primaryPrincipal.getName(),
                 ResourceType.PRINCIPAL, ActionOutcome.SUCCESS, RES.effectiveUser(mappedPrincipalName) );
           }
diff --git a/gateway-provider-rewrite/pom.xml b/gateway-provider-rewrite/pom.xml
index eaca142..c57aa23 100644
--- a/gateway-provider-rewrite/pom.xml
+++ b/gateway-provider-rewrite/pom.xml
@@ -91,10 +91,6 @@
             <artifactId>jackson-databind</artifactId>
         </dependency>
         <dependency>
-            <groupId>log4j</groupId>
-            <artifactId>log4j</artifactId>
-        </dependency>
-        <dependency>
             <groupId>org.apache.httpcomponents</groupId>
             <artifactId>httpcore</artifactId>
         </dependency>
@@ -133,6 +129,10 @@
             <groupId>org.apache.logging.log4j</groupId>
             <artifactId>log4j-api</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.apache.logging.log4j</groupId>
+            <artifactId>log4j-core</artifactId>
+        </dependency>
 
         <!-- ********** ********** ********** ********** ********** ********** -->
         <!-- ********** Test Dependencies                           ********** -->
diff --git a/gateway-provider-rewrite/src/test/java/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteRulesDescriptorFactoryTest.java b/gateway-provider-rewrite/src/test/java/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteRulesDescriptorFactoryTest.java
index ce355c0..3ebebbf 100644
--- a/gateway-provider-rewrite/src/test/java/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteRulesDescriptorFactoryTest.java
+++ b/gateway-provider-rewrite/src/test/java/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteRulesDescriptorFactoryTest.java
@@ -17,8 +17,9 @@
  */
 package org.apache.knox.gateway.filter.rewrite.api;
 
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.core.Logger;
 import org.hamcrest.Matchers;
 import org.junit.Test;
 import org.xmlmatchers.transform.XmlConverters;
@@ -98,10 +99,10 @@ public class UrlRewriteRulesDescriptorFactoryTest {
 
   @Test
   public void testLoadEmptyFile() {
-    Logger logger = org.apache.log4j.LogManager.getLogger( "org.apache.commons.digester3.Digester" );
+    Logger logger = (Logger)LogManager.getLogger( "org.apache.commons.digester3.Digester" );
     Level level = logger.getLevel();
     try {
-      logger.setLevel( org.apache.log4j.Level.OFF );
+      logger.setLevel( Level.OFF );
       UrlRewriteRulesDescriptorFactory.load( "xml", getTestResourceReader( "empty.xml" ) );
       fail( "Should have thrown an IOException." );
     } catch ( IOException e ) {
@@ -118,10 +119,10 @@ public class UrlRewriteRulesDescriptorFactoryTest {
 
   @Test
   public void testLoadInvalidFile() {
-    Logger logger = org.apache.log4j.LogManager.getLogger( "org.apache.commons.digester3.Digester" );
+    Logger logger = (Logger)LogManager.getLogger( "org.apache.commons.digester3.Digester" );
     Level level = logger.getLevel();
     try {
-      logger.setLevel( org.apache.log4j.Level.OFF );
+      logger.setLevel( Level.OFF );
       UrlRewriteRulesDescriptorFactory.load( "xml", getTestResourceReader( "invalid.xml" ) );
       fail( "Should have thrown an IOException." );
     } catch ( IOException e ) {
diff --git a/gateway-provider-rewrite/src/test/java/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteServletFilterTest.java b/gateway-provider-rewrite/src/test/java/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteServletFilterTest.java
index 88babd6..31c7bec 100644
--- a/gateway-provider-rewrite/src/test/java/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteServletFilterTest.java
+++ b/gateway-provider-rewrite/src/test/java/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteServletFilterTest.java
@@ -21,10 +21,8 @@ import com.jayway.jsonassert.JsonAssert;
 import org.apache.knox.gateway.filter.AbstractGatewayFilter;
 import org.apache.knox.gateway.util.urltemplate.Parser;
 import org.apache.knox.test.TestUtils;
-import org.apache.knox.test.log.NoOpAppender;
 import org.apache.knox.test.mock.MockInteraction;
 import org.apache.knox.test.mock.MockServlet;
-import org.apache.log4j.Appender;
 import org.eclipse.jetty.http.HttpHeader;
 import org.eclipse.jetty.http.HttpTester;
 import org.eclipse.jetty.servlet.FilterHolder;
@@ -47,7 +45,6 @@ import java.net.URL;
 import java.nio.charset.StandardCharsets;
 import java.util.ArrayDeque;
 import java.util.EnumSet;
-import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Queue;
@@ -60,7 +57,6 @@ import static org.xmlmatchers.XmlMatchers.hasXPath;
 import static org.xmlmatchers.transform.XmlConverters.the;
 
 public class UrlRewriteServletFilterTest {
-
   private ServletTester server;
   private HttpTester.Request request;
   private HttpTester.Response response;
@@ -527,41 +523,35 @@ public class UrlRewriteServletFilterTest {
 
   @Test
   public void testRequestXmlBodyRewriteWithFilterInitParamForInvalidFilterConfig() throws Exception {
-    Enumeration<Appender> realAppenders = NoOpAppender.setUpAndReturnOriginalAppenders();
-    try {
-
-      Map<String,String> initParams = new HashMap<>();
-      initParams.put( "request.body", "test-filter-3" );
-      testSetUp( initParams );
-
-      String input = "<root url='http://mock-host:42/test-input-path-1'><url>http://mock-host:42/test-input-path-2</url></root>";
-      String expect = "<root url='http://mock-host:42/test-input-path-2'><url>http://mock-host:42/test-input-path-2</url></root>";
-
-      // Setup the server side request/response interaction.
-      interaction.expect()
-          .method( "PUT" )
-          .requestUrl( "http://mock-host:42/test-output-path-1" )
-          .contentType( "text/xml" )
-          .characterEncoding( StandardCharsets.UTF_8.name() )
-          .content( expect, StandardCharsets.UTF_8 );
-      interaction.respond()
-          .status( 200 );
-      interactions.add( interaction );
-      request.setMethod( "PUT" );
-      request.setURI( "/test-input-path" );
-      //request.setVersion( "HTTP/1.1" );
-      request.setHeader( "Host", "mock-host:42" );
-      request.setHeader( "Content-Type", "text/xml; charset=UTF-8" );
-      request.setContent( input );
-
-      // Execute the request.
-      response = TestUtils.execute( server, request );
-
-      // Test the results.
-      assertThat( response.getStatus(), is( 500 ) );
-    } finally {
-      NoOpAppender.resetOriginalAppenders( realAppenders );
-    }
+    Map<String,String> initParams = new HashMap<>();
+    initParams.put( "request.body", "test-filter-3" );
+    testSetUp( initParams );
+
+    String input = "<root url='http://mock-host:42/test-input-path-1'><url>http://mock-host:42/test-input-path-2</url></root>";
+    String expect = "<root url='http://mock-host:42/test-input-path-2'><url>http://mock-host:42/test-input-path-2</url></root>";
+
+    // Setup the server side request/response interaction.
+    interaction.expect()
+        .method( "PUT" )
+        .requestUrl( "http://mock-host:42/test-output-path-1" )
+        .contentType( "text/xml" )
+        .characterEncoding( StandardCharsets.UTF_8.name() )
+        .content( expect, StandardCharsets.UTF_8 );
+    interaction.respond()
+        .status( 200 );
+    interactions.add( interaction );
+    request.setMethod( "PUT" );
+    request.setURI( "/test-input-path" );
+    //request.setVersion( "HTTP/1.1" );
+    request.setHeader( "Host", "mock-host:42" );
+    request.setHeader( "Content-Type", "text/xml; charset=UTF-8" );
+    request.setContent( input );
+
+    // Execute the request.
+    response = TestUtils.execute( server, request );
+
+    // Test the results.
+    assertThat( response.getStatus(), is( 500 ) );
   }
 
   @Test
diff --git a/gateway-provider-rewrite/src/test/resources/log4j.properties b/gateway-provider-rewrite/src/test/resources/log4j.properties
deleted file mode 100644
index be84440..0000000
--- a/gateway-provider-rewrite/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,37 +0,0 @@
-##########################################################################
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-##########################################################################
-
-log4j.rootLogger=ERROR, stdout
-
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%5p [%c] %m%n
-
-#log4j.logger.org.apache.knox.gateway=DEBUG
-#log4j.logger.org.apache.knox.gateway.http=TRACE
-#log4j.logger.org.apache.knox.gateway.http.request.body=OFF
-#log4j.logger.org.apache.knox.gateway.http.response.body=OFF
-
-#log4j.logger.org.apache.directory=DEBUG
-#log4j.logger.org.eclipse.jetty=DEBUG
-#log4j.logger.org.apache.shiro=DEBUG
-#log4j.logger.org.apache.http=DEBUG
-#log4j.logger.org.apache.http.headers=DEBUG
-#log4j.logger.org.apache.http.wire=DEBUG
-#log4j.logger.org.apache.http.client=DEBUG
-
diff --git a/gateway-provider-rewrite/src/test/resources/log4j2.xml b/gateway-provider-rewrite/src/test/resources/log4j2.xml
new file mode 100644
index 0000000..80fa696
--- /dev/null
+++ b/gateway-provider-rewrite/src/test/resources/log4j2.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<Configuration>
+    <Appenders>
+        <Console name="stdout" target="SYSTEM_OUT">
+            <PatternLayout pattern="%5p [%c] %m%n" />
+        </Console>
+    </Appenders>
+    <Loggers>
+        <Root level="error">
+            <AppenderRef ref="stdout"/>
+        </Root>
+<!--        <Logger name="org.apache.knox.gateway" level="DEBUG" />-->
+<!--        <Logger name="org.apache.knox.gateway.http" level="TRACE" />-->
+<!--        <Logger name="org.apache.knox.gateway.http.request.body" level="OFF" />-->
+<!--        <Logger name="org.apache.knox.gateway.http.response.body" level="OFF" />-->
+<!--        <Logger name="org.apache.directory" level="DEBUG" />-->
+<!--        <Logger name="org.eclipse.jetty" level="DEBUG" />-->
+<!--        <Logger name="org.apache.shiro" level="DEBUG" />-->
+<!--        <Logger name="org.apache.http" level="DEBUG" />-->
+<!--        <Logger name="org.apache.http.headers" level="DEBUG" />-->
+<!--        <Logger name="org.apache.http.wire" level="DEBUG" />-->
+<!--        <Logger name="org.apache.http.client" level="DEBUG" />-->
+    </Loggers>
+</Configuration>
diff --git a/gateway-provider-security-authc-anon/src/main/java/org/apache/knox/gateway/filter/AnonymousAuthFilter.java b/gateway-provider-security-authc-anon/src/main/java/org/apache/knox/gateway/filter/AnonymousAuthFilter.java
index 11d7334..b0b2a85 100755
--- a/gateway-provider-security-authc-anon/src/main/java/org/apache/knox/gateway/filter/AnonymousAuthFilter.java
+++ b/gateway-provider-security-authc-anon/src/main/java/org/apache/knox/gateway/filter/AnonymousAuthFilter.java
@@ -19,6 +19,7 @@ package org.apache.knox.gateway.filter;
 
 import org.apache.knox.gateway.audit.api.Action;
 import org.apache.knox.gateway.audit.api.ActionOutcome;
+import org.apache.knox.gateway.audit.api.AuditContext;
 import org.apache.knox.gateway.audit.api.AuditService;
 import org.apache.knox.gateway.audit.api.AuditServiceFactory;
 import org.apache.knox.gateway.audit.api.Auditor;
@@ -60,7 +61,9 @@ public class AnonymousAuthFilter implements Filter {
     }
     Subject subject = new Subject();
     subject.getPrincipals().add(new PrimaryPrincipal(principal));
-    auditService.getContext().setUsername( principal ); //KM: Audit Fix
+    AuditContext context = auditService.getContext();
+    context.setUsername( principal );
+    auditService.attachContext(context);
     String sourceUri = (String)request.getAttribute( AbstractGatewayFilter.SOURCE_REQUEST_CONTEXT_URL_ATTRIBUTE_NAME );
     auditor.audit( Action.AUTHENTICATION , sourceUri, ResourceType.URI, ActionOutcome.SUCCESS );
     continueWithEstablishedSecurityContext(subject, (HttpServletRequest)request, (HttpServletResponse)response, filterChain);
diff --git a/gateway-provider-security-hadoopauth/pom.xml b/gateway-provider-security-hadoopauth/pom.xml
index d1bed82..45855e3 100755
--- a/gateway-provider-security-hadoopauth/pom.xml
+++ b/gateway-provider-security-hadoopauth/pom.xml
@@ -56,6 +56,11 @@
         </dependency>
 
         <dependency>
+            <groupId>org.apache.hadoop</groupId>
+            <artifactId>hadoop-annotations</artifactId>
+        </dependency>
+
+        <dependency>
             <groupId>javax.servlet</groupId>
             <artifactId>javax.servlet-api</artifactId>
         </dependency>
diff --git a/gateway-provider-security-hadoopauth/src/main/java/org/apache/knox/gateway/hadoopauth/filter/HadoopAuthPostFilter.java b/gateway-provider-security-hadoopauth/src/main/java/org/apache/knox/gateway/hadoopauth/filter/HadoopAuthPostFilter.java
index 9cb8040..e839cf7 100755
--- a/gateway-provider-security-hadoopauth/src/main/java/org/apache/knox/gateway/hadoopauth/filter/HadoopAuthPostFilter.java
+++ b/gateway-provider-security-hadoopauth/src/main/java/org/apache/knox/gateway/hadoopauth/filter/HadoopAuthPostFilter.java
@@ -36,6 +36,7 @@ import javax.servlet.ServletResponse;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import org.apache.knox.gateway.audit.api.AuditContext;
 import org.apache.commons.lang3.tuple.Pair;
 import org.apache.knox.gateway.security.PrimaryPrincipal;
 import org.apache.knox.gateway.audit.api.AuditService;
@@ -96,12 +97,14 @@ public class HadoopAuthPostFilter implements Filter {
       if (principal != null) {
         subject = new Subject();
         subject.getPrincipals().add(new PrimaryPrincipal(principal));
+        AuditContext context = auditService.getContext();
+        context.setUsername(principal);
+        auditService.attachContext(context);
       }
     }
 
     if (subject != null) {
         log.hadoopAuthAssertedPrincipal(getPrincipalsAsString(subject));
-        auditService.getContext().setUsername(getPrincipalsAsString(subject)); //KM: Audit Fix
         String sourceUri = (String)request.getAttribute( AbstractGatewayFilter.SOURCE_REQUEST_CONTEXT_URL_ATTRIBUTE_NAME );
         auditor.audit( Action.AUTHENTICATION , sourceUri, ResourceType.URI, ActionOutcome.SUCCESS );
         doAs(request, response, chain, subject);
diff --git a/gateway-provider-security-jwt/pom.xml b/gateway-provider-security-jwt/pom.xml
index 25a0d16..6696cac 100644
--- a/gateway-provider-security-jwt/pom.xml
+++ b/gateway-provider-security-jwt/pom.xml
@@ -67,11 +67,6 @@
         </dependency>
 
         <dependency>
-            <groupId>log4j</groupId>
-            <artifactId>log4j</artifactId>
-        </dependency>
-
-        <dependency>
             <groupId>org.apache.commons</groupId>
             <artifactId>commons-lang3</artifactId>
         </dependency>
diff --git a/gateway-provider-security-jwt/src/main/java/org/apache/knox/gateway/provider/federation/jwt/filter/AbstractJWTFilter.java b/gateway-provider-security-jwt/src/main/java/org/apache/knox/gateway/provider/federation/jwt/filter/AbstractJWTFilter.java
index fc5b797..a8da01a 100644
--- a/gateway-provider-security-jwt/src/main/java/org/apache/knox/gateway/provider/federation/jwt/filter/AbstractJWTFilter.java
+++ b/gateway-provider-security-jwt/src/main/java/org/apache/knox/gateway/provider/federation/jwt/filter/AbstractJWTFilter.java
@@ -234,6 +234,7 @@ public abstract class AbstractJWTFilter implements Filter {
     AuditContext context = auditService.getContext();
     if (context != null) {
       context.setUsername( principal.getName() );
+      auditService.attachContext(context);
       String sourceUri = (String)request.getAttribute( AbstractGatewayFilter.SOURCE_REQUEST_CONTEXT_URL_ATTRIBUTE_NAME );
       if (sourceUri != null) {
         auditor.audit( Action.AUTHENTICATION , sourceUri, ResourceType.URI, ActionOutcome.SUCCESS );
diff --git a/gateway-provider-security-pac4j/pom.xml b/gateway-provider-security-pac4j/pom.xml
index 5529788..023f606 100644
--- a/gateway-provider-security-pac4j/pom.xml
+++ b/gateway-provider-security-pac4j/pom.xml
@@ -60,10 +60,10 @@
         </dependency>
 
         <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-api</artifactId>
+            <groupId>org.apache.logging.log4j</groupId>
+            <artifactId>log4j-api</artifactId>
         </dependency>
-
+        
         <dependency>
             <groupId>javax.servlet</groupId>
             <artifactId>javax.servlet-api</artifactId>
@@ -102,6 +102,12 @@
         <dependency>
             <groupId>org.pac4j</groupId>
             <artifactId>pac4j-http</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.slf4j</groupId>
+                    <artifactId>slf4j-api</artifactId>
+                </exclusion>
+            </exclusions>
         </dependency>
         <dependency>
             <groupId>org.pac4j</groupId>
@@ -127,6 +133,10 @@
                     <groupId>org.springframework</groupId>
                     <artifactId>spring-core</artifactId>
                 </exclusion>
+                <exclusion>
+                    <groupId>org.slf4j</groupId>
+                    <artifactId>slf4j-api</artifactId>
+                </exclusion>
             </exclusions>
         </dependency>
 
diff --git a/gateway-provider-security-pac4j/src/main/java/org/apache/knox/gateway/pac4j/filter/Pac4jIdentityAdapter.java b/gateway-provider-security-pac4j/src/main/java/org/apache/knox/gateway/pac4j/filter/Pac4jIdentityAdapter.java
index dc74510..82864e1 100644
--- a/gateway-provider-security-pac4j/src/main/java/org/apache/knox/gateway/pac4j/filter/Pac4jIdentityAdapter.java
+++ b/gateway-provider-security-pac4j/src/main/java/org/apache/knox/gateway/pac4j/filter/Pac4jIdentityAdapter.java
@@ -19,6 +19,7 @@ package org.apache.knox.gateway.pac4j.filter;
 
 import org.apache.knox.gateway.audit.api.Action;
 import org.apache.knox.gateway.audit.api.ActionOutcome;
+import org.apache.knox.gateway.audit.api.AuditContext;
 import org.apache.knox.gateway.audit.api.AuditService;
 import org.apache.knox.gateway.audit.api.AuditServiceFactory;
 import org.apache.knox.gateway.audit.api.Auditor;
@@ -26,12 +27,12 @@ import org.apache.knox.gateway.audit.api.ResourceType;
 import org.apache.knox.gateway.audit.log4j.audit.AuditConstants;
 import org.apache.knox.gateway.filter.AbstractGatewayFilter;
 import org.apache.knox.gateway.security.PrimaryPrincipal;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 import org.pac4j.core.config.Config;
 import org.pac4j.core.context.JEEContext;
 import org.pac4j.core.profile.CommonProfile;
 import org.pac4j.core.profile.ProfileManager;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 import javax.security.auth.Subject;
 import javax.servlet.Filter;
@@ -54,7 +55,7 @@ import java.util.Optional;
  */
 public class Pac4jIdentityAdapter implements Filter {
 
-  private static final Logger logger = LoggerFactory.getLogger(Pac4jIdentityAdapter.class);
+  private static final Logger logger = LogManager.getLogger(Pac4jIdentityAdapter.class);
 
   public static final String PAC4J_ID_ATTRIBUTE = "pac4j.id_attribute";
   private static final String PAC4J_CONFIG = "pac4j.config";
@@ -109,7 +110,10 @@ public class Pac4jIdentityAdapter implements Filter {
       PrimaryPrincipal pp = new PrimaryPrincipal(id);
       Subject subject = new Subject();
       subject.getPrincipals().add(pp);
-      auditService.getContext().setUsername(id);
+
+      AuditContext auditContext = auditService.getContext();
+      auditContext.setUsername(id);
+      auditService.attachContext(auditContext);
       String sourceUri = (String)request.getAttribute( AbstractGatewayFilter.SOURCE_REQUEST_CONTEXT_URL_ATTRIBUTE_NAME );
       auditor.audit(Action.AUTHENTICATION, sourceUri, ResourceType.URI, ActionOutcome.SUCCESS);
 
diff --git a/gateway-provider-security-pac4j/src/main/java/org/apache/knox/gateway/pac4j/session/KnoxSessionStore.java b/gateway-provider-security-pac4j/src/main/java/org/apache/knox/gateway/pac4j/session/KnoxSessionStore.java
index 32c886a..040c82d 100644
--- a/gateway-provider-security-pac4j/src/main/java/org/apache/knox/gateway/pac4j/session/KnoxSessionStore.java
+++ b/gateway-provider-security-pac4j/src/main/java/org/apache/knox/gateway/pac4j/session/KnoxSessionStore.java
@@ -24,6 +24,8 @@ import org.apache.knox.gateway.pac4j.filter.Pac4jDispatcherFilter;
 import org.apache.knox.gateway.services.security.CryptoService;
 import org.apache.knox.gateway.services.security.EncryptionResult;
 import org.apache.knox.gateway.util.Urls;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 import org.pac4j.core.context.ContextHelper;
 import org.pac4j.core.context.Cookie;
 import org.pac4j.core.context.JEEContext;
@@ -33,8 +35,6 @@ import org.pac4j.core.exception.TechnicalException;
 import org.pac4j.core.profile.CommonProfile;
 import org.pac4j.core.util.JavaSerializationHelper;
 import org.pac4j.core.util.Pac4jConstants;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
@@ -65,7 +65,7 @@ import static org.apache.knox.gateway.pac4j.filter.Pac4jDispatcherFilter.PAC4J_S
  */
 public class KnoxSessionStore<C extends WebContext> implements SessionStore<C> {
 
-    private static final Logger logger = LoggerFactory.getLogger(KnoxSessionStore.class);
+    private static final Logger logger = LogManager.getLogger(KnoxSessionStore.class);
 
     public static final String PAC4J_PASSWORD = "pac4j.password";
 
diff --git a/gateway-provider-security-preauth/src/main/java/org/apache/knox/gateway/preauth/filter/AbstractPreAuthFederationFilter.java b/gateway-provider-security-preauth/src/main/java/org/apache/knox/gateway/preauth/filter/AbstractPreAuthFederationFilter.java
index 0b74c5e..4c3399f 100644
--- a/gateway-provider-security-preauth/src/main/java/org/apache/knox/gateway/preauth/filter/AbstractPreAuthFederationFilter.java
+++ b/gateway-provider-security-preauth/src/main/java/org/apache/knox/gateway/preauth/filter/AbstractPreAuthFederationFilter.java
@@ -36,6 +36,7 @@ import javax.servlet.http.HttpServletResponse;
 
 import org.apache.knox.gateway.audit.api.Action;
 import org.apache.knox.gateway.audit.api.ActionOutcome;
+import org.apache.knox.gateway.audit.api.AuditContext;
 import org.apache.knox.gateway.audit.api.AuditService;
 import org.apache.knox.gateway.audit.api.AuditServiceFactory;
 import org.apache.knox.gateway.audit.api.Auditor;
@@ -78,7 +79,9 @@ public abstract class AbstractPreAuthFederationFilter implements Filter {
         Subject subject = new Subject();
         subject.getPrincipals().add(new PrimaryPrincipal(principal));
         addGroupPrincipals(httpRequest, subject.getPrincipals());
-        auditService.getContext().setUsername( principal ); //KM: Audit Fix
+        AuditContext context = auditService.getContext();
+        context.setUsername( principal );
+        auditService.attachContext(context);
         String sourceUri = (String)request.getAttribute( AbstractGatewayFilter.SOURCE_REQUEST_CONTEXT_URL_ATTRIBUTE_NAME );
         auditor.audit( Action.AUTHENTICATION , sourceUri, ResourceType.URI, ActionOutcome.SUCCESS );
         doAs(httpRequest, response, chain, subject);
diff --git a/gateway-provider-security-shiro/src/main/java/org/apache/knox/gateway/filter/ShiroSubjectIdentityAdapter.java b/gateway-provider-security-shiro/src/main/java/org/apache/knox/gateway/filter/ShiroSubjectIdentityAdapter.java
index a98ace9..7bcbc82 100644
--- a/gateway-provider-security-shiro/src/main/java/org/apache/knox/gateway/filter/ShiroSubjectIdentityAdapter.java
+++ b/gateway-provider-security-shiro/src/main/java/org/apache/knox/gateway/filter/ShiroSubjectIdentityAdapter.java
@@ -33,6 +33,7 @@ import javax.servlet.ServletResponse;
 
 import org.apache.knox.gateway.audit.api.Action;
 import org.apache.knox.gateway.audit.api.ActionOutcome;
+import org.apache.knox.gateway.audit.api.AuditContext;
 import org.apache.knox.gateway.audit.api.AuditService;
 import org.apache.knox.gateway.audit.api.AuditServiceFactory;
 import org.apache.knox.gateway.audit.api.Auditor;
@@ -102,7 +103,9 @@ public class ShiroSubjectIdentityAdapter implements Filter {
       Set<Principal> principals = new HashSet<>();
       Principal p = new PrimaryPrincipal(principal);
       principals.add(p);
-      auditService.getContext().setUsername( principal ); //KM: Audit Fix
+      AuditContext context = auditService.getContext();
+      context.setUsername( principal );
+      auditService.attachContext(context);
       String sourceUri = (String)request.getAttribute( AbstractGatewayFilter.SOURCE_REQUEST_CONTEXT_URL_ATTRIBUTE_NAME );
       auditor.audit( Action.AUTHENTICATION , sourceUri, ResourceType.URI, ActionOutcome.SUCCESS );
 
diff --git a/gateway-release-common/home/bin/knox-env.sh b/gateway-release-common/home/bin/knox-env.sh
index 2979a63..3ff3101 100644
--- a/gateway-release-common/home/bin/knox-env.sh
+++ b/gateway-release-common/home/bin/knox-env.sh
@@ -34,7 +34,7 @@
 ## Defaults to {GATEWAY_HOME}/logs
 # export KNOX_GATEWAY_LOG_DIR=""
 
-## KNOX_GATEWAY_LOG_OPTS is a placeholder to set the gateway server's Log4j options (e.g. "-Dlog4j.debug -Dlog4j.configuration=foobar.xml")
+## KNOX_GATEWAY_LOG_OPTS is a placeholder to set the gateway server's Log4j options (e.g. "-Dlog4j.debug -Dlog4j.configurationFile=foobar.xml")
 ## Defaults to an empty string
 # export KNOX_GATEWAY_LOG_OPTS=""
 
@@ -60,7 +60,7 @@
 #### KNOX-CLI RELATED ENVIRONMENT VARIABLES ####
 ################################################
 
-## KNOX_CLI_LOG_OPTS is a placeholder to set KnoxCLI's Log4j options (e.g. "-Dlog4j.debug -Dlog4j.configuration=foobar.xml")
+## KNOX_CLI_LOG_OPTS is a placeholder to set KnoxCLI's Log4j options (e.g. "-Dlog4j.debug -Dlog4j.configurationFile=foobar.xml")
 ## Defaults to an empty string
 # export KNOX_CLI_LOG_OPTS=""
 
@@ -85,7 +85,7 @@
 ## Defaults to {GATEWAY_HOME}/logs
 # export KNOX_LDAP_LOG_DIR=""
 
-## KNOX_LDAP_LOG_OPTS is a placeholder to set the test LDAP server's Log4j options (e.g. "-Dlog4j.debug -Dlog4j.configuration=foobar.xml")
+## KNOX_LDAP_LOG_OPTS is a placeholder to set the test LDAP server's Log4j options (e.g. "-Dlog4j.debug -Dlog4j.configurationFile=foobar.xml")
 ## Defaults to an empty string
 # export KNOX_LDAP_LOG_OPTS=""
 
@@ -102,7 +102,7 @@
 #### KNOX-SHELL RELATED ENVIRONMENT VARIABLES ####
 ##################################################
 
-## KNOX_SHELL_LOG_OPTS is a placeholder to set KnoxShell's Log4j options (e.g. "-Dlog4j.debug -Dlog4j.configuration=foobar.xml")
+## KNOX_SHELL_LOG_OPTS is a placeholder to set KnoxShell's Log4j options (e.g. "-Dlog4j.debug -Dlog4j.configurationFile=foobar.xml")
 ## Defaults to an empty string
 # export KNOX_SHELL_LOG_OPTS=""
 
diff --git a/gateway-release/home/conf/gateway-log4j.properties b/gateway-release/home/conf/gateway-log4j.properties
deleted file mode 100644
index ece2fbb..0000000
--- a/gateway-release/home/conf/gateway-log4j.properties
+++ /dev/null
@@ -1,85 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-app.log.dir=${launcher.dir}/../logs
-app.log.file=${launcher.name}.log
-app.audit.file=${launcher.name}-audit.log
-
-log4j.rootLogger=ERROR, drfa
-
-log4j.logger.org.apache.knox.gateway=INFO
-#log4j.logger.org.apache.knox.gateway=DEBUG
-
-#log4j.logger.org.eclipse.jetty=DEBUG
-#log4j.logger.org.apache.shiro=DEBUG
-#log4j.logger.org.apache.http=DEBUG
-#log4j.logger.org.apache.http.client=DEBUG
-#log4j.logger.org.apache.http.headers=DEBUG
-#log4j.logger.org.apache.http.wire=DEBUG
-
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d{yy/MM/dd HH:mm:ss} %p %c{2}: %m%n
-
-log4j.appender.drfa=org.apache.log4j.DailyRollingFileAppender
-log4j.appender.drfa.File=${app.log.dir}/${app.log.file}
-log4j.appender.drfa.DatePattern=.yyyy-MM-dd
-log4j.appender.drfa.layout=org.apache.log4j.PatternLayout
-log4j.appender.drfa.layout.ConversionPattern=%d{ISO8601} %-5p %c{2} (%F:%M(%L)) - %m%n
-
-log4j.logger.audit=INFO, auditfile
-log4j.appender.auditfile=org.apache.log4j.DailyRollingFileAppender
-log4j.appender.auditfile.File=${app.log.dir}/${app.audit.file}
-log4j.appender.auditfile.Append = true
-log4j.appender.auditfile.DatePattern = '.'yyyy-MM-dd
-log4j.appender.auditfile.layout = org.apache.knox.gateway.audit.log4j.layout.AuditLayout
-
-#log4j.logger.org.apache.knox.gateway.access=TRACE,httpaccess
-#log4j.additivity.org.apache.knox.gateway.access=false
-
-#log4j.logger.org.apache.knox.gateway.http=TRACE,httpserver
-#log4j.additivity.org.apache.knox.gateway.http=false
-##log4j.logger.org.apache.knox.gateway.http.request.headers=OFF
-##log4j.logger.org.apache.knox.gateway.http.response.headers=OFF
-##log4j.logger.org.apache.knox.gateway.http.request.body=OFF
-##log4j.logger.org.apache.knox.gateway.http.response.body=OFF
-
-#log4j.logger.org.apache.http.wire=DEBUG,httpclient
-#log4j.additivity.org.apache.http.wire=false
-
-#log4j.appender.httpaccess=org.apache.log4j.DailyRollingFileAppender
-#log4j.appender.httpaccess.File=${app.log.dir}/${launcher.name}-http-access.log
-#log4j.appender.httpaccess.DatePattern=.yyyy-MM-dd
-#log4j.appender.httpaccess.layout=org.apache.log4j.PatternLayout
-#log4j.appender.httpaccess.layout.ConversionPattern=%d{ISO8601}|%t|%m%n
-
-#log4j.appender.httpserver=org.apache.log4j.DailyRollingFileAppender
-#log4j.appender.httpserver.File=${app.log.dir}/${launcher.name}-http-server.log
-#log4j.appender.httpserver.DatePattern=.yyyy-MM-dd
-#log4j.appender.httpserver.layout=org.apache.log4j.PatternLayout
-#log4j.appender.httpserver.layout.ConversionPattern=%d{ISO8601}|%t|%m%n
-
-#log4j.appender.httpclient=org.apache.log4j.DailyRollingFileAppender
-#log4j.appender.httpclient.File=${app.log.dir}/${launcher.name}-http-client.log
-#log4j.appender.httpclient.DatePattern=.yyyy-MM-dd
-#log4j.appender.httpclient.layout=org.apache.log4j.PatternLayout
-#log4j.appender.httpclient.layout.ConversionPattern=%d{ISO8601}|%t|%m%n
-
-# Apache Shiro Related logging - KNOX-757
-#log4j.logger.org.springframework=DEBUG
-#log4j.logger.net.sf.ehcache=DEBUG
-#log4j.logger.org.apache.shiro.util.ThreadContext=DEBUG
-
diff --git a/gateway-release/home/conf/gateway-log4j2.xml b/gateway-release/home/conf/gateway-log4j2.xml
new file mode 100644
index 0000000..ef62df5
--- /dev/null
+++ b/gateway-release/home/conf/gateway-log4j2.xml
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<Configuration>
+    <Properties>
+        <Property name="app.log.dir">${sys:launcher.dir}/../logs</Property>
+        <Property name="app.log.file">${sys:launcher.name}.log</Property>
+        <Property name="app.audit.file">${sys:launcher.name}-audit.log</Property>
+    </Properties>
+
+    <Appenders>
+        <RollingFile name="auditfile" fileName="${app.log.dir}/${app.audit.file}" filePattern="${app.log.dir}/${app.audit.file}.%d{yyyy-MM-dd}">
+            <AuditLayout />
+            <TimeBasedTriggeringPolicy />
+        </RollingFile>
+        <Console name="stdout" target="SYSTEM_OUT">
+            <PatternLayout pattern="%d{yy/MM/dd HH:mm:ss} %p %c{2}: %m%n" />
+        </Console>
+        <RollingFile name="drfa" fileName="${app.log.dir}/${app.log.file}" filePattern="${app.log.dir}/${app.log.file}.%d{yyyy-MM-dd}">
+            <!-- Same as ISO8601 format but without the 'T' (log4j1 compatible) -->
+            <PatternLayout pattern="%d{yyyy-MM-dd' 'HH:mm:ss,SSS} %-5p %c{2} (%F:%M(%L)) - %m%n" />
+            <TimeBasedTriggeringPolicy />
+        </RollingFile>
+<!--        <RollingFile name="httpclient" fileName="${app.log.dir}/${launcher.name}-http-client.log" filePattern="${app.log.dir}/${launcher.name}-http-client.log.%d{yyyy-MM-dd}">-->
+<!--            <PatternLayout pattern="%d{ISO8601}|%t|%m%n" />-->
+<!--            <TimeBasedTriggeringPolicy />-->
+<!--        </RollingFile>-->
+<!--        <RollingFile name="httpaccess" fileName="${app.log.dir}/${launcher.name}-http-access.log" filePattern="${app.log.dir}/${launcher.name}-http-access.log.%d{yyyy-MM-dd}">-->
+<!--            <PatternLayout pattern="%d{ISO8601}|%t|%m%n" />-->
+<!--            <TimeBasedTriggeringPolicy />-->
+<!--        </RollingFile>-->
+<!--        <RollingFile name="httpserver" fileName="${app.log.dir}/${launcher.name}-http-server.log" filePattern="${app.log.dir}/${launcher.name}-http-server.log.%d{yyyy-MM-dd}">-->
+<!--            <PatternLayout pattern="%d{ISO8601}|%t|%m%n" />-->
+<!--            <TimeBasedTriggeringPolicy />-->
+<!--        </RollingFile>-->
+    </Appenders>
+    <Loggers>
+        <Logger name="audit" level="INFO">
+            <AppenderRef ref="auditfile" />
+        </Logger>
+        <Logger name="org.apache.knox.gateway" level="INFO" />
+        <Root level="ERROR">
+            <AppenderRef ref="drfa" />
+        </Root>
+<!--        <Logger name="org.springframework" level="DEBUG" />-->
+<!--        <Logger name="org.apache.knox.gateway.http.request.body" level="OFF" />-->
+<!--        <Logger name="org.apache.knox.gateway.http" level="TRACE">-->
+<!--            <AppenderRef ref="httpserver" />-->
+<!--        </Logger>-->
+<!--        <Logger name="org.apache.shiro" level="DEBUG" />-->
+<!--        <Logger name="org.apache.knox.gateway.http.response.body" level="OFF" />-->
+<!--        <Logger name="org.apache.http.client" level="DEBUG" />-->
+<!--        <Logger name="org.apache.knox.gateway.http.request.headers" level="OFF" />-->
+<!--        <Logger name="org.apache.http.wire" level="DEBUG">-->
+<!--            <AppenderRef ref="httpclient" />-->
+<!--        </Logger>-->
+<!--        <Logger name="org.apache.knox.gateway.http.response.headers" level="OFF" />-->
+<!--        <Logger name="net.sf.ehcache" level="DEBUG" />-->
+<!--        <Logger name="org.apache.http" level="DEBUG" />-->
+<!--        <Logger name="org.apache.http.headers" level="DEBUG" />-->
+<!--        <Logger name="org.apache.shiro.util.ThreadContext" level="DEBUG" />-->
+<!--        <Logger name="org.apache.knox.gateway" level="DEBUG" />-->
+<!--        <Logger name="org.eclipse.jetty" level="DEBUG" />-->
+<!--        <Logger name="org.apache.knox.gateway.access" level="TRACE">-->
+<!--            <AppenderRef ref="httpaccess" />-->
+<!--        </Logger>-->
+    </Loggers>
+</Configuration>
diff --git a/gateway-release/home/conf/knoxcli-log4j.properties b/gateway-release/home/conf/knoxcli-log4j.properties
deleted file mode 100644
index 4a8317e..0000000
--- a/gateway-release/home/conf/knoxcli-log4j.properties
+++ /dev/null
@@ -1,34 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-app.log.dir=${launcher.dir}/../logs
-app.log.file=${launcher.name}.log
-
-log4j.rootLogger=ERROR, drfa
-
-log4j.logger.org.apache.knox.gateway=INFO
-#log4j.logger.org.apache.knox.gateway=DEBUG
-
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d{yy/MM/dd HH:mm:ss} %p %c{2}: %m%n
-
-log4j.appender.drfa=org.apache.log4j.DailyRollingFileAppender
-log4j.appender.drfa.File=${app.log.dir}/${app.log.file}
-log4j.appender.drfa.DatePattern=.yyyy-MM-dd
-log4j.appender.drfa.layout=org.apache.log4j.PatternLayout
-log4j.appender.drfa.layout.ConversionPattern=%d{ISO8601} %-5p %c{2} (%F:%M(%L)) - %m%n
-
diff --git a/gateway-release/home/conf/knoxcli-log4j2.xml b/gateway-release/home/conf/knoxcli-log4j2.xml
new file mode 100644
index 0000000..a36979d
--- /dev/null
+++ b/gateway-release/home/conf/knoxcli-log4j2.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<Configuration>
+    <Properties>
+        <Property name="app.log.dir">${sys:launcher.dir}/../logs</Property>
+        <Property name="app.log.file">${sys:launcher.name}.log</Property>
+    </Properties>
+    <Appenders>
+        <Console name="stdout" target="SYSTEM_OUT">
+            <PatternLayout pattern="%d{yy/MM/dd HH:mm:ss} %p %c{2}: %m%n" />
+        </Console>
+        <RollingFile name="drfa" fileName="${app.log.dir}/${app.log.file}" filePattern="${app.log.dir}/${app.log.file}.%d{yyyy-MM-dd}">
+            <PatternLayout pattern="%d{ISO8601} %-5p %c{2} (%F:%M(%L)) - %m%n" />
+            <TimeBasedTriggeringPolicy />
+        </RollingFile>
+    </Appenders>
+    <Loggers>
+        <Logger name="org.apache.knox.gateway" level="INFO" />
+        <Root level="ERROR">
+            <AppenderRef ref="drfa" />
+        </Root>
+    </Loggers>
+</Configuration>
\ No newline at end of file
diff --git a/gateway-release/home/conf/ldap-log4j.properties b/gateway-release/home/conf/ldap-log4j.properties
deleted file mode 100644
index fabb47f..0000000
--- a/gateway-release/home/conf/ldap-log4j.properties
+++ /dev/null
@@ -1,32 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-app.log.dir=${launcher.dir}/../logs
-app.log.file=${launcher.name}.log
-
-log4j.rootLogger=ERROR, drfa
-log4j.logger.org.apache.directory.server.ldap.LdapServer=INFO
-log4j.logger.org.apache.directory=WARN
-
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d{yy/MM/dd HH:mm:ss} %p %c{2}: %m%n
-
-log4j.appender.drfa=org.apache.log4j.DailyRollingFileAppender
-log4j.appender.drfa.File=${app.log.dir}/${app.log.file}
-log4j.appender.drfa.DatePattern=.yyyy-MM-dd
-log4j.appender.drfa.layout=org.apache.log4j.PatternLayout
-log4j.appender.drfa.layout.ConversionPattern=%d{ISO8601} %-5p %c{2} (%F:%M(%L)) - %m%n
\ No newline at end of file
diff --git a/gateway-release/home/conf/ldap-log4j2.xml b/gateway-release/home/conf/ldap-log4j2.xml
new file mode 100644
index 0000000..28e375f
--- /dev/null
+++ b/gateway-release/home/conf/ldap-log4j2.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<Configuration>
+    <Properties>
+        <Property name="app.log.dir">${sys:launcher.dir}/../logs</Property>
+        <Property name="app.log.file">${sys:launcher.name}.log</Property>
+    </Properties>
+    <Appenders>
+        <Console name="stdout" target="SYSTEM_OUT">
+            <PatternLayout pattern="%d{yy/MM/dd HH:mm:ss} %p %c{2}: %m%n" />
+        </Console>
+        <RollingFile name="drfa" fileName="${app.log.dir}/${app.log.file}" filePattern="${app.log.dir}/${app.log.file}.%d{yyyy-MM-dd}">
+            <PatternLayout pattern="%d{ISO8601} %-5p %c{2} (%F:%M(%L)) - %m%n" />
+            <TimeBasedTriggeringPolicy />
+        </RollingFile>
+    </Appenders>
+    <Loggers>
+        <Logger name="org.apache.directory" level="WARN" />
+        <Logger name="org.apache.directory.server.ldap.LdapServer" level="INFO" />
+        <Root level="ERROR">
+            <AppenderRef ref="drfa" />
+        </Root>
+    </Loggers>
+</Configuration>
diff --git a/gateway-release/home/conf/shell-log4j.properties b/gateway-release/home/conf/shell-log4j.properties
deleted file mode 100644
index 18593fe..0000000
--- a/gateway-release/home/conf/shell-log4j.properties
+++ /dev/null
@@ -1,33 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-app.log.dir=${launcher.dir}/../logs
-app.log.file=${launcher.name}.log
-
-log4j.rootLogger=ERROR, drfa
-
-#log4j.logger.org.apache.http.wire=DEBUG
-
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d{yy/MM/dd HH:mm:ss} %p %c{2}: %m%n
-
-log4j.appender.drfa=org.apache.log4j.DailyRollingFileAppender
-log4j.appender.drfa.File=${app.log.dir}/${app.log.file}
-log4j.appender.drfa.DatePattern=.yyyy-MM-dd
-log4j.appender.drfa.layout=org.apache.log4j.PatternLayout
-log4j.appender.drfa.layout.ConversionPattern=%d{ISO8601} %-5p %c{2} (%F:%M(%L)) - %m%n
-
diff --git a/gateway-release/home/conf/shell-log4j2.xml b/gateway-release/home/conf/shell-log4j2.xml
new file mode 100644
index 0000000..925d5c5
--- /dev/null
+++ b/gateway-release/home/conf/shell-log4j2.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<Configuration>
+    <Properties>
+        <Property name="app.log.dir">${sys:launcher.dir}/../logs</Property>
+        <Property name="app.log.file">${sys:launcher.name}.log</Property>
+    </Properties>
+    <Appenders>
+        <Console name="stdout" target="SYSTEM_OUT">
+            <PatternLayout pattern="%d{yy/MM/dd HH:mm:ss} %p %c{2}: %m%n" />
+        </Console>
+        <RollingFile name="drfa" fileName="${app.log.dir}/${app.log.file}" filePattern="${app.log.dir}/${app.log.file}.%d{yyyy-MM-dd}">
+            <PatternLayout pattern="%d{ISO8601} %-5p %c{2} (%F:%M(%L)) - %m%n" />
+            <TimeBasedTriggeringPolicy />
+        </RollingFile>
+    </Appenders>
+    <Loggers>
+        <Root level="ERROR">
+            <AppenderRef ref="drfa" />
+        </Root>
+    </Loggers>
+</Configuration>
\ No newline at end of file
diff --git a/gateway-server-launcher/src/main/resources/META-INF/launcher.cfg b/gateway-server-launcher/src/main/resources/META-INF/launcher.cfg
index c866c62..3554a23 100644
--- a/gateway-server-launcher/src/main/resources/META-INF/launcher.cfg
+++ b/gateway-server-launcher/src/main/resources/META-INF/launcher.cfg
@@ -15,4 +15,4 @@
 main.class = org.apache.knox.gateway.GatewayServer
 class.path = ../conf;../lib/*.jar;../dep/*.jar;../ext;../ext/*.jar
 GATEWAY_HOME=${launcher.dir}/..
-log4j.configuration=${GATEWAY_HOME}/conf/${launcher.name}-log4j.properties
+log4j.configurationFile=${GATEWAY_HOME}/conf/${launcher.name}-log4j2.xml
diff --git a/gateway-server/pom.xml b/gateway-server/pom.xml
index 55a2504..89da9d3 100644
--- a/gateway-server/pom.xml
+++ b/gateway-server/pom.xml
@@ -114,14 +114,18 @@
             <groupId>org.apache.hadoop</groupId>
             <artifactId>hadoop-auth</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.apache.hadoop</groupId>
+            <artifactId>hadoop-annotations</artifactId>
+        </dependency>
 
         <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-api</artifactId>
+            <groupId>org.apache.logging.log4j</groupId>
+            <artifactId>log4j-api</artifactId>
         </dependency>
         <dependency>
-            <groupId>log4j</groupId>
-            <artifactId>log4j</artifactId>
+            <groupId>org.apache.logging.log4j</groupId>
+            <artifactId>log4j-core</artifactId>
         </dependency>
 
         <dependency>
diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/GatewayFilter.java b/gateway-server/src/main/java/org/apache/knox/gateway/GatewayFilter.java
index ba05169..e8f0b49 100644
--- a/gateway-server/src/main/java/org/apache/knox/gateway/GatewayFilter.java
+++ b/gateway-server/src/main/java/org/apache/knox/gateway/GatewayFilter.java
@@ -17,6 +17,27 @@
  */
 package org.apache.knox.gateway;
 
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletRequestWrapper;
+import javax.servlet.http.HttpServletResponse;
+
 import org.apache.knox.gateway.audit.api.Action;
 import org.apache.knox.gateway.audit.api.ActionOutcome;
 import org.apache.knox.gateway.audit.api.AuditContext;
@@ -24,9 +45,11 @@ import org.apache.knox.gateway.audit.api.AuditService;
 import org.apache.knox.gateway.audit.api.AuditServiceFactory;
 import org.apache.knox.gateway.audit.api.Auditor;
 import org.apache.knox.gateway.audit.api.CorrelationContext;
+import org.apache.knox.gateway.audit.api.CorrelationService;
 import org.apache.knox.gateway.audit.api.CorrelationServiceFactory;
 import org.apache.knox.gateway.audit.api.ResourceType;
 import org.apache.knox.gateway.audit.log4j.audit.AuditConstants;
+import org.apache.knox.gateway.audit.log4j.correlation.Log4jCorrelationContext;
 import org.apache.knox.gateway.config.GatewayConfig;
 import org.apache.knox.gateway.filter.AbstractGatewayFilter;
 import org.apache.knox.gateway.i18n.messages.MessagesFactory;
@@ -37,28 +60,6 @@ import org.apache.knox.gateway.util.urltemplate.Matcher;
 import org.apache.knox.gateway.util.urltemplate.Parser;
 import org.apache.knox.gateway.util.urltemplate.Template;
 
-import javax.servlet.Filter;
-import javax.servlet.FilterChain;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletContext;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletRequestWrapper;
-import javax.servlet.http.HttpServletResponse;
-
-import java.io.IOException;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.UUID;
-
 public class GatewayFilter implements Filter {
 
   private static final FilterChain EMPTY_CHAIN = new FilterChain() {
@@ -152,9 +153,13 @@ public class GatewayFilter implements Filter {
     assignCorrelationRequestId();
     // Populate Audit/correlation parameters
     AuditContext auditContext = auditService.getContext();
+    if(auditContext == null) {
+      auditContext = auditService.createContext();
+    }
     auditContext.setTargetServiceName( match == null ? null : match.getValue().getResourceRole() );
     auditContext.setRemoteIp( getRemoteAddress(servletRequest) );
     auditContext.setRemoteHostname( servletRequest.getRemoteHost() );
+    auditService.attachContext(auditContext);
     auditor.audit(
         Action.ACCESS, contextWithPathAndQuery, ResourceType.URI,
         ActionOutcome.UNAVAILABLE, RES.requestMethod(((HttpServletRequest)servletRequest).getMethod()));
@@ -232,13 +237,10 @@ public class GatewayFilter implements Filter {
 
   // Now creating the correlation context only if required since it may be created upstream in the CorrelationHandler.
   private void assignCorrelationRequestId() {
-    CorrelationContext correlationContext = CorrelationServiceFactory.getCorrelationService().getContext();
+    CorrelationService correlationService = CorrelationServiceFactory.getCorrelationService();
+    CorrelationContext correlationContext = correlationService.getContext();
     if( correlationContext == null ) {
-      correlationContext = CorrelationServiceFactory.getCorrelationService().createContext();
-    }
-    String requestId = correlationContext.getRequestId();
-    if( requestId == null ) {
-      correlationContext.setRequestId( UUID.randomUUID().toString() );
+      correlationService.attachContext(new Log4jCorrelationContext(UUID.randomUUID().toString(), null, null));
     }
   }
 
diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/GatewayServer.java b/gateway-server/src/main/java/org/apache/knox/gateway/GatewayServer.java
index bb3676a..00c0da4 100644
--- a/gateway-server/src/main/java/org/apache/knox/gateway/GatewayServer.java
+++ b/gateway-server/src/main/java/org/apache/knox/gateway/GatewayServer.java
@@ -56,7 +56,6 @@ import org.apache.knox.gateway.trace.TraceHandler;
 import org.apache.knox.gateway.util.Urls;
 import org.apache.knox.gateway.util.XmlUtils;
 import org.apache.knox.gateway.websockets.GatewayWebsocketHandler;
-import org.apache.log4j.PropertyConfigurator;
 import org.eclipse.jetty.server.ConnectionFactory;
 import org.eclipse.jetty.server.Connector;
 import org.eclipse.jetty.server.Handler;
@@ -149,7 +148,6 @@ public class GatewayServer {
 
   public static void main( String[] args ) {
     try {
-      configureLogging();
       logSysProps();
       CommandLine cmd = GatewayCommandLine.parse( args );
       if( cmd.hasOption( GatewayCommandLine.HELP_LONG ) ) {
@@ -234,24 +232,6 @@ public class GatewayServer {
     logSysProp( "java.home" );
   }
 
-  private static void configureLogging() {
-    PropertyConfigurator.configure( System.getProperty( "log4j.configuration" ) );
-//    String fileName = config.getGatewayConfDir() + File.separator + "log4j.properties";
-//    File file = new File( fileName );
-//    if( file.isFile() && file.canRead() ) {
-//      FileInputStream stream;
-//      try {
-//        stream = new FileInputStream( file );
-//        Properties properties = new Properties();
-//        properties.load( stream );
-//        PropertyConfigurator.configure( properties );
-//        log.loadedLoggingConfig( fileName );
-//      } catch( IOException e ) {
-//        log.failedToLoadLoggingConfig( fileName );
-//      }
-//    }
-  }
-
   private static void configureKerberosSecurity( GatewayConfig config ) {
     setSystemProperty(GatewayConfig.HADOOP_KERBEROS_SECURED, "true");
     setSystemProperty(GatewayConfig.KRB5_CONFIG, config.getKerberosConfig());
diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/filter/CorrelationHandler.java b/gateway-server/src/main/java/org/apache/knox/gateway/filter/CorrelationHandler.java
index 909c362..7b6dab2 100644
--- a/gateway-server/src/main/java/org/apache/knox/gateway/filter/CorrelationHandler.java
+++ b/gateway-server/src/main/java/org/apache/knox/gateway/filter/CorrelationHandler.java
@@ -17,31 +17,29 @@
  */
 package org.apache.knox.gateway.filter;
 
-import org.apache.knox.gateway.audit.api.CorrelationContext;
+import java.io.IOException;
+import java.util.UUID;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
 import org.apache.knox.gateway.audit.api.CorrelationService;
 import org.apache.knox.gateway.audit.api.CorrelationServiceFactory;
+import org.apache.knox.gateway.audit.log4j.correlation.Log4jCorrelationContext;
 import org.eclipse.jetty.server.Request;
 import org.eclipse.jetty.server.handler.HandlerWrapper;
 
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.util.UUID;
-
 public class CorrelationHandler extends HandlerWrapper {
 
   @Override
   public void handle( String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response )
       throws IOException, ServletException {
     CorrelationService correlationService = CorrelationServiceFactory.getCorrelationService();
-    CorrelationContext correlationContext = correlationService.createContext();
-    correlationContext.setRequestId( UUID.randomUUID().toString() );
+    correlationService.attachContext(
+            new Log4jCorrelationContext(UUID.randomUUID().toString(), null, null));
     try {
       super.handle( target, baseRequest, request, response );
     } finally {
-      // Ensure that the correlationContext is destroyed between requests
-      correlationContext.destroy();
       correlationService.detachContext();
     }
   }
diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/trace/AccessHandler.java b/gateway-server/src/main/java/org/apache/knox/gateway/trace/AccessHandler.java
index 4411dbd..c21e5eb 100644
--- a/gateway-server/src/main/java/org/apache/knox/gateway/trace/AccessHandler.java
+++ b/gateway-server/src/main/java/org/apache/knox/gateway/trace/AccessHandler.java
@@ -17,14 +17,15 @@
  */
 package org.apache.knox.gateway.trace;
 
-import org.apache.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 import org.eclipse.jetty.server.Request;
 import org.eclipse.jetty.server.RequestLog;
 import org.eclipse.jetty.server.Response;
 import org.eclipse.jetty.util.component.AbstractLifeCycle;
 
 public class AccessHandler extends AbstractLifeCycle implements RequestLog {
-  private static final Logger log = Logger.getLogger( "org.apache.knox.gateway.access" );
+  private static final Logger log = LogManager.getLogger( "org.apache.knox.gateway.access" );
 
   @Override
   public void log( Request request, Response response ) {
diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/trace/TraceInput.java b/gateway-server/src/main/java/org/apache/knox/gateway/trace/TraceInput.java
index 1e146e5..846c6c8 100644
--- a/gateway-server/src/main/java/org/apache/knox/gateway/trace/TraceInput.java
+++ b/gateway-server/src/main/java/org/apache/knox/gateway/trace/TraceInput.java
@@ -18,15 +18,16 @@
 package org.apache.knox.gateway.trace;
 
 import org.apache.knox.gateway.servlet.SynchronousServletInputStreamAdapter;
-import org.apache.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 
 import javax.servlet.ServletInputStream;
 import java.io.IOException;
 import java.util.Locale;
 
 class TraceInput extends SynchronousServletInputStreamAdapter {
-  private static final Logger log = Logger.getLogger( TraceHandler.HTTP_REQUEST_LOGGER );
-  private static final Logger bodyLog = Logger.getLogger( TraceHandler.HTTP_REQUEST_BODY_LOGGER );
+  private static final Logger log = LogManager.getLogger( TraceHandler.HTTP_REQUEST_LOGGER );
+  private static final Logger bodyLog = LogManager.getLogger( TraceHandler.HTTP_REQUEST_BODY_LOGGER );
 
   private ServletInputStream delegate;
 
diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/trace/TraceOutput.java b/gateway-server/src/main/java/org/apache/knox/gateway/trace/TraceOutput.java
index 6fb6ed9..4bb123a 100644
--- a/gateway-server/src/main/java/org/apache/knox/gateway/trace/TraceOutput.java
+++ b/gateway-server/src/main/java/org/apache/knox/gateway/trace/TraceOutput.java
@@ -18,15 +18,16 @@
 package org.apache.knox.gateway.trace;
 
 import org.apache.knox.gateway.servlet.SynchronousServletOutputStreamAdapter;
-import org.apache.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 
 import javax.servlet.ServletOutputStream;
 import java.io.IOException;
 import java.util.Locale;
 
 class TraceOutput extends SynchronousServletOutputStreamAdapter {
-  private static final Logger log = Logger.getLogger( TraceHandler.HTTP_RESPONSE_LOGGER );
-  private static final Logger bodyLog = Logger.getLogger( TraceHandler.HTTP_RESPONSE_BODY_LOGGER );
+  private static final Logger log = LogManager.getLogger( TraceHandler.HTTP_RESPONSE_LOGGER );
+  private static final Logger bodyLog = LogManager.getLogger( TraceHandler.HTTP_RESPONSE_BODY_LOGGER );
 
   private ServletOutputStream delegate;
 
diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/trace/TraceRequest.java b/gateway-server/src/main/java/org/apache/knox/gateway/trace/TraceRequest.java
index 4fbbf64..d8b84d2 100644
--- a/gateway-server/src/main/java/org/apache/knox/gateway/trace/TraceRequest.java
+++ b/gateway-server/src/main/java/org/apache/knox/gateway/trace/TraceRequest.java
@@ -17,7 +17,8 @@
  */
 package org.apache.knox.gateway.trace;
 
-import org.apache.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 
 import javax.servlet.ServletInputStream;
 import javax.servlet.http.HttpServletRequest;
@@ -27,8 +28,8 @@ import java.util.Enumeration;
 import java.util.Locale;
 
 class TraceRequest extends HttpServletRequestWrapper {
-  private static final Logger log = Logger.getLogger( TraceHandler.HTTP_REQUEST_LOGGER );
-  private static final Logger headLog = Logger.getLogger( TraceHandler.HTTP_REQUEST_HEADER_LOGGER );
+  private static final Logger log = LogManager.getLogger( TraceHandler.HTTP_REQUEST_LOGGER );
+  private static final Logger headLog = LogManager.getLogger( TraceHandler.HTTP_REQUEST_HEADER_LOGGER );
 
   private ServletInputStream input;
 
diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/trace/TraceResponse.java b/gateway-server/src/main/java/org/apache/knox/gateway/trace/TraceResponse.java
index ac1e3c4..3912bce 100644
--- a/gateway-server/src/main/java/org/apache/knox/gateway/trace/TraceResponse.java
+++ b/gateway-server/src/main/java/org/apache/knox/gateway/trace/TraceResponse.java
@@ -17,7 +17,8 @@
  */
 package org.apache.knox.gateway.trace;
 
-import org.apache.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 
 import javax.servlet.ServletOutputStream;
 import javax.servlet.http.HttpServletResponse;
@@ -28,13 +29,12 @@ import java.util.Locale;
 import java.util.Set;
 
 class TraceResponse extends HttpServletResponseWrapper {
-  private static final Logger log = Logger.getLogger( TraceHandler.HTTP_RESPONSE_LOGGER );
-  private static final Logger headLog = Logger.getLogger( TraceHandler.HTTP_RESPONSE_HEADER_LOGGER );
+  private static final Logger log = LogManager.getLogger( TraceHandler.HTTP_RESPONSE_LOGGER );
+  private static final Logger headLog = LogManager.getLogger( TraceHandler.HTTP_RESPONSE_HEADER_LOGGER );
 
   private ServletOutputStream output;
   private Set<Integer> filter;
 
-
   TraceResponse( HttpServletResponse response, Set<Integer> filter ) {
     super( response );
     this.filter = filter;
diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/util/KnoxCLI.java b/gateway-server/src/main/java/org/apache/knox/gateway/util/KnoxCLI.java
index db0ff0c..53bacce 100644
--- a/gateway-server/src/main/java/org/apache/knox/gateway/util/KnoxCLI.java
+++ b/gateway-server/src/main/java/org/apache/knox/gateway/util/KnoxCLI.java
@@ -79,7 +79,6 @@ import org.apache.knox.gateway.services.topology.TopologyService;
 import org.apache.knox.gateway.topology.Provider;
 import org.apache.knox.gateway.topology.Topology;
 import org.apache.knox.gateway.topology.validation.TopologyValidator;
-import org.apache.log4j.PropertyConfigurator;
 import org.apache.shiro.SecurityUtils;
 import org.apache.shiro.authc.AuthenticationException;
 import org.apache.shiro.authc.UsernamePasswordToken;
@@ -2339,7 +2338,6 @@ public class KnoxCLI extends Configured implements Tool {
   }
 
   public static void main(String[] args) throws Exception {
-    PropertyConfigurator.configure( System.getProperty( "log4j.configuration" ) );
     int res = ToolRunner.run(new GatewayConfigImpl(), new KnoxCLI(), args);
     System.exit(res);
   }
diff --git a/gateway-server/src/main/resources/conf/log4j.properties b/gateway-server/src/main/resources/conf/log4j.properties
deleted file mode 100644
index ffb5d20..0000000
--- a/gateway-server/src/main/resources/conf/log4j.properties
+++ /dev/null
@@ -1,24 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-log4j.rootLogger=INFO,stdout
-log4j.threshhold=ALL
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-#log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} %-5p [%t] %c{2} (%F:%M(%L)) - %m%n
-log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} %-5p [%t] %m%n
-
-log4j.logger.org.apache.knox.gateway=INFO
\ No newline at end of file
diff --git a/gateway-server/src/main/resources/conf/log4j2.xml b/gateway-server/src/main/resources/conf/log4j2.xml
new file mode 100644
index 0000000..9d83610
--- /dev/null
+++ b/gateway-server/src/main/resources/conf/log4j2.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<Configuration>
+    <Appenders>
+        <Console name="stdout" target="SYSTEM_OUT">
+            <PatternLayout pattern="%d{ISO8601} %-5p [%t] %m%n" />
+        </Console>
+    </Appenders>
+    <Loggers>
+        <Logger name="org.apache.knox.gateway" level="INFO" />
+        <Root level="INFO">
+            <AppenderRef ref="stdout" />
+        </Root>
+<!--        <Logger name="org.apache.knox.gateway" level="DEBUG" />-->
+<!--        <Logger name="org.eclipse.jetty" level="DEBUG" />-->
+<!--        <Logger name="org.apache.shiro" level="DEBUG" />-->
+<!--        <Logger name="org.apache.http" level="DEBUG" />-->
+<!--        <Logger name="org.apache.http.wire" level="DEBUG" />-->
+<!--        <Logger name="org.apache.http.client" level="DEBUG" />-->
+    </Loggers>
+</Configuration>
\ No newline at end of file
diff --git a/gateway-server/src/test/java/org/apache/knox/gateway/AuditLoggingTest.java b/gateway-server/src/test/java/org/apache/knox/gateway/AuditLoggingTest.java
index 13bd3fd..3741f29 100644
--- a/gateway-server/src/test/java/org/apache/knox/gateway/AuditLoggingTest.java
+++ b/gateway-server/src/test/java/org/apache/knox/gateway/AuditLoggingTest.java
@@ -26,18 +26,19 @@ import org.apache.knox.gateway.audit.api.AuditServiceFactory;
 import org.apache.knox.gateway.audit.api.CorrelationContext;
 import org.apache.knox.gateway.audit.api.ResourceType;
 import org.apache.knox.gateway.audit.log4j.audit.AuditConstants;
-import org.apache.knox.gateway.audit.log4j.audit.Log4jAuditService;
-import org.apache.knox.gateway.audit.log4j.correlation.Log4jCorrelationService;
+import org.apache.knox.gateway.audit.log4j.audit.Log4jAuditContext;
+import org.apache.knox.gateway.audit.log4j.correlation.Log4jCorrelationContext;
 import org.apache.knox.gateway.config.GatewayConfig;
 import org.apache.knox.gateway.dispatch.DefaultDispatch;
 import org.apache.knox.test.log.CollectAppender;
-import org.apache.log4j.spi.LoggingEvent;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.core.LogEvent;
+import org.apache.logging.log4j.util.ReadOnlyStringMap;
 import org.easymock.EasyMock;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 import javax.servlet.Filter;
 import javax.servlet.FilterChain;
@@ -68,7 +69,7 @@ import static org.hamcrest.core.IsNull.nullValue;
 import static org.junit.Assert.fail;
 
 public class AuditLoggingTest {
-  private static Logger LOG = LoggerFactory.getLogger( AuditLoggingTest.class );
+  private static Logger LOG = LogManager.getLogger( AuditLoggingTest.class );
 
   private static final String METHOD = "GET";
   private static final String PATH = "path";
@@ -151,10 +152,10 @@ public class AuditLoggingTest {
 
     // Use a set to make sure to dedupe any requestIds to get only unique ones
     Set<String> requestIds = new HashSet<>();
-    for (LoggingEvent accessEvent : CollectAppender.queue) {
+    for (LogEvent accessEvent : CollectAppender.queue) {
       verifyAuditEvent( accessEvent, CONTEXT_PATH + PATH, ResourceType.URI, Action.ACCESS, ActionOutcome.UNAVAILABLE, null, "Request method: GET" );
 
-      CorrelationContext cc = (CorrelationContext)accessEvent.getMDC( Log4jCorrelationService.MDC_CORRELATION_CONTEXT_KEY );
+      CorrelationContext cc = Log4jCorrelationContext.of(accessEvent);
       // There are some events that do not have a CorrelationContext associated (ie: deploy)
       if(cc != null) {
         requestIds.add(cc.getRequestId());
@@ -210,8 +211,8 @@ public class AuditLoggingTest {
     gateway.destroy();
 
     assertThat( CollectAppender.queue.size(), is( 1 ) );
-    Iterator<LoggingEvent> iterator = CollectAppender.queue.iterator();
-    LoggingEvent accessEvent = iterator.next();
+    Iterator<LogEvent> iterator = CollectAppender.queue.iterator();
+    LogEvent accessEvent = iterator.next();
     verifyAuditEvent( accessEvent, CONTEXT_PATH + PATH, ResourceType.URI,
         Action.ACCESS, ActionOutcome.UNAVAILABLE, null, "Request method: GET" );
 
@@ -243,43 +244,45 @@ public class AuditLoggingTest {
       dispatch.doGet( new URI( uri ), inboundRequest, outboundResponse );
       fail( "Expected exception while accessing to unreachable host" );
     } catch ( IOException e ) {
-      Iterator<LoggingEvent> iterator = CollectAppender.queue.iterator();
+      Iterator<LogEvent> iterator = CollectAppender.queue.iterator();
 
-      LoggingEvent unavailableEvent = iterator.next();
-      verifyValue( (String) unavailableEvent.getMDC( AuditConstants.MDC_RESOURCE_NAME_KEY ), uri );
-      verifyValue( (String) unavailableEvent.getMDC( AuditConstants.MDC_RESOURCE_TYPE_KEY ), ResourceType.URI );
-      verifyValue( (String) unavailableEvent.getMDC( AuditConstants.MDC_ACTION_KEY ), Action.DISPATCH );
-      verifyValue( (String) unavailableEvent.getMDC( AuditConstants.MDC_OUTCOME_KEY ), ActionOutcome.UNAVAILABLE );
+      LogEvent unavailableEvent = iterator.next();
+      verifyValue(unavailableEvent.getContextData().getValue( AuditConstants.MDC_RESOURCE_NAME_KEY ), uri );
+      verifyValue(unavailableEvent.getContextData().getValue( AuditConstants.MDC_RESOURCE_TYPE_KEY ), ResourceType.URI );
+      verifyValue(unavailableEvent.getContextData().getValue( AuditConstants.MDC_ACTION_KEY ), Action.DISPATCH );
+      verifyValue(unavailableEvent.getContextData().getValue( AuditConstants.MDC_OUTCOME_KEY ), ActionOutcome.UNAVAILABLE );
 
-      LoggingEvent failureEvent = iterator.next();
-      verifyValue( (String) failureEvent.getMDC( AuditConstants.MDC_RESOURCE_NAME_KEY ), uri );
-      verifyValue( (String) failureEvent.getMDC( AuditConstants.MDC_RESOURCE_TYPE_KEY ), ResourceType.URI );
-      verifyValue( (String) failureEvent.getMDC( AuditConstants.MDC_ACTION_KEY ), Action.DISPATCH );
-      verifyValue( (String) failureEvent.getMDC( AuditConstants.MDC_OUTCOME_KEY ), ActionOutcome.FAILURE );
+      LogEvent failureEvent = iterator.next();
+      verifyValue(failureEvent.getContextData().getValue( AuditConstants.MDC_RESOURCE_NAME_KEY ), uri );
+      verifyValue(failureEvent.getContextData().getValue( AuditConstants.MDC_RESOURCE_TYPE_KEY ), ResourceType.URI );
+      verifyValue(failureEvent.getContextData().getValue( AuditConstants.MDC_ACTION_KEY ), Action.DISPATCH );
+      verifyValue(failureEvent.getContextData().getValue( AuditConstants.MDC_OUTCOME_KEY ), ActionOutcome.FAILURE );
 
     }
   }
 
-  private void verifyAuditEvent( LoggingEvent event, String resourceName,
+  private void verifyAuditEvent( LogEvent event, String resourceName,
       String resourceType, String action, String outcome, String targetService,
       String message ) {
-    event.getMDCCopy();
-    CorrelationContext cc = (CorrelationContext) event.getMDC( Log4jCorrelationService.MDC_CORRELATION_CONTEXT_KEY );
-    assertThat( cc, notNullValue() );
-    assertThat( cc.getRequestId(), is( notNullValue() ) );
-    AuditContext ac = (AuditContext) event.getMDC( Log4jAuditService.MDC_AUDIT_CONTEXT_KEY );
-    assertThat( ac, notNullValue() );
-    assertThat( ac.getRemoteIp(), is( ADDRESS ) );
-    assertThat( ac.getRemoteHostname(), is( HOST ) );
-    assertThat(event.getMDC( AuditConstants.MDC_SERVICE_KEY ), is( AuditConstants.KNOX_SERVICE_NAME ) );
-    assertThat(event.getMDC( AuditConstants.MDC_COMPONENT_KEY ), is( AuditConstants.KNOX_COMPONENT_NAME ) );
-    assertThat(event.getLoggerName(), is( AuditConstants.DEFAULT_AUDITOR_NAME ) );
-    verifyValue( (String) event.getMDC( AuditConstants.MDC_RESOURCE_NAME_KEY ), resourceName );
-    verifyValue( (String) event.getMDC( AuditConstants.MDC_RESOURCE_TYPE_KEY ), resourceType );
-    verifyValue( (String) event.getMDC( AuditConstants.MDC_ACTION_KEY ), action );
-    verifyValue( (String) event.getMDC( AuditConstants.MDC_OUTCOME_KEY ), outcome );
-    verifyValue( ac.getTargetServiceName(), targetService );
-    verifyValue( event.getRenderedMessage(), message );
+
+    ReadOnlyStringMap eventContextData = event.getContextData();
+
+    CorrelationContext cc = Log4jCorrelationContext.of(event);
+    assertThat(cc, notNullValue());
+    assertThat(cc.getRequestId(), is(notNullValue()));
+    AuditContext ac = Log4jAuditContext.of(event);
+    assertThat(ac, notNullValue());
+    assertThat(ac.getRemoteIp(), is(ADDRESS));
+    assertThat(ac.getRemoteHostname(), is(HOST));
+    assertThat(eventContextData.getValue(AuditConstants.MDC_SERVICE_KEY), is(AuditConstants.KNOX_SERVICE_NAME));
+    assertThat(eventContextData.getValue(AuditConstants.MDC_COMPONENT_KEY), is(AuditConstants.KNOX_COMPONENT_NAME));
+    assertThat(event.getLoggerName(), is(AuditConstants.DEFAULT_AUDITOR_NAME));
+    verifyValue(eventContextData.getValue(AuditConstants.MDC_RESOURCE_NAME_KEY), resourceName);
+    verifyValue(eventContextData.getValue(AuditConstants.MDC_RESOURCE_TYPE_KEY), resourceType);
+    verifyValue(eventContextData.getValue(AuditConstants.MDC_ACTION_KEY), action);
+    verifyValue(eventContextData.getValue(AuditConstants.MDC_OUTCOME_KEY), outcome);
+    verifyValue(ac.getTargetServiceName(), targetService);
+    verifyValue(event.getMessage().getFormattedMessage(), message);
   }
 
   private void verifyValue( String actual, String expected ) {
diff --git a/gateway-server/src/test/java/org/apache/knox/gateway/descriptor/xml/XmlGatewayDescriptorImporterTest.java b/gateway-server/src/test/java/org/apache/knox/gateway/descriptor/xml/XmlGatewayDescriptorImporterTest.java
index 16110f3..b670505 100644
--- a/gateway-server/src/test/java/org/apache/knox/gateway/descriptor/xml/XmlGatewayDescriptorImporterTest.java
+++ b/gateway-server/src/test/java/org/apache/knox/gateway/descriptor/xml/XmlGatewayDescriptorImporterTest.java
@@ -22,8 +22,9 @@ import org.apache.knox.gateway.descriptor.FilterParamDescriptor;
 import org.apache.knox.gateway.descriptor.GatewayDescriptor;
 import org.apache.knox.gateway.descriptor.GatewayDescriptorFactory;
 import org.apache.knox.gateway.descriptor.ResourceDescriptor;
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.core.Logger;
 import org.junit.Test;
 
 import java.io.IOException;
@@ -153,7 +154,7 @@ public class XmlGatewayDescriptorImporterTest {
 
     Reader reader = new StringReader( xml );
     // Keep the tests quiet.  Ignore the stack trace that ends up being written to System.out.
-    Logger logger = Logger.getLogger( "org.apache.commons.digester3.Digester" );
+    Logger logger = (Logger)LogManager.getLogger( "org.apache.commons.digester3.Digester" );
     Level level = logger.getLevel();
     logger.setLevel( Level.OFF );
     PrintStream out = System.out;
diff --git a/gateway-server/src/test/java/org/apache/knox/gateway/topology/builder/PropertyTopologyBuilderTest.java b/gateway-server/src/test/java/org/apache/knox/gateway/topology/builder/PropertyTopologyBuilderTest.java
index 3f09214..fbb5f36 100644
--- a/gateway-server/src/test/java/org/apache/knox/gateway/topology/builder/PropertyTopologyBuilderTest.java
+++ b/gateway-server/src/test/java/org/apache/knox/gateway/topology/builder/PropertyTopologyBuilderTest.java
@@ -16,14 +16,8 @@
  */
 package org.apache.knox.gateway.topology.builder;
 
-import java.util.Enumeration;
-
 import org.apache.knox.gateway.topology.Topology;
 import org.apache.knox.gateway.topology.builder.property.Property;
-import org.apache.knox.test.log.NoOpAppender;
-import org.apache.log4j.Appender;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
 import org.junit.Test;
 
 import static org.hamcrest.MatcherAssert.assertThat;
@@ -31,19 +25,6 @@ import static org.hamcrest.core.Is.is;
 import static org.hamcrest.core.IsNull.notNullValue;
 
 public class PropertyTopologyBuilderTest {
-
-  private static Enumeration<Appender> realAppenders;
-
-  @BeforeClass
-  public static void setUpBeforeClass() {
-    realAppenders = NoOpAppender.setUpAndReturnOriginalAppenders();
-  }
-
-  @AfterClass
-  public static void tearDownAfterClass() {
-    NoOpAppender.resetOriginalAppenders( realAppenders );
-  }
-
   @Test( expected = IllegalArgumentException.class )
   public void testBuildFailedForWrongProperty() {
     PropertyTopologyBuilder propertyTopologyBuilder = new PropertyTopologyBuilder();
diff --git a/gateway-server/src/test/resources/log4j.properties b/gateway-server/src/test/resources/log4j.properties
deleted file mode 100644
index f35213e..0000000
--- a/gateway-server/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,35 +0,0 @@
-##########################################################################
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-##########################################################################
-
-#log4j.rootLogger=DEBUG, stdout
-log4j.rootLogger=ERROR, stdout
-
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%5p [%c] %m%n
-
-log4j.logger.audit = INFO, collectappender
-log4j.appender.collectappender = org.apache.knox.test.log.CollectAppender
-
-#log4j.logger.org.apache.knox.gateway=DEBUG
-#log4j.logger.org.eclipse.jetty=DEBUG
-#log4j.logger.org.apache.shiro=DEBUG
-#log4j.logger.org.apache.http=DEBUG
-#log4j.logger.org.apache.http.wire=DEBUG
-#log4j.logger.org.apache.http.client=DEBUG
-
diff --git a/gateway-server/src/test/resources/log4j2-test.xml b/gateway-server/src/test/resources/log4j2-test.xml
new file mode 100644
index 0000000..5888f31
--- /dev/null
+++ b/gateway-server/src/test/resources/log4j2-test.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<Configuration>
+    <Appenders>
+        <Console name="console" target="SYSTEM_OUT">
+            <PatternLayout pattern="[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n"/>
+        </Console>
+        <CollectAppender name="collectappender" />
+    </Appenders>
+    <Loggers>
+        <Root level="error">
+            <AppenderRef ref="console" />
+        </Root>
+        <Logger name="audit" level="info">
+            <AppenderRef ref="collectappender" />
+        </Logger>
+    </Loggers>
+</Configuration>
diff --git a/gateway-server/src/test/resources/logging.properties b/gateway-server/src/test/resources/logging.properties
deleted file mode 100644
index de1aa3a..0000000
--- a/gateway-server/src/test/resources/logging.properties
+++ /dev/null
@@ -1,87 +0,0 @@
-##########################################################################
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-##########################################################################
-
-############################################################
-#  Default Logging Configuration File
-#
-# You can use a different file by specifying a filename
-# with the java.util.logging.config.file system property.  
-# For example java -Djava.util.logging.config.file=myfile
-############################################################
-
-############################################################
-#  Global properties
-############################################################
-
-# "handlers" specifies a comma separated list of log Handler 
-# classes.  These handlers will be installed during VM startup.
-# Note that these classes must be on the system classpath.
-# By default we only configure a ConsoleHandler, which will only
-# show messages at the INFO and above levels.
-handlers= java.util.logging.ConsoleHandler
-
-# To also addValue the FileHandler, use the following line instead.
-#handlers= java.util.logging.FileHandler, java.util.logging.ConsoleHandler
-
-# Default global logging level.
-# This specifies which kinds of events are logged across
-# all loggers.  For any given facility this global level
-# can be overriden by a facility specific level
-# Note that the ConsoleHandler also has a separate level
-# setting to limit messages printed to the console.
-.level= FINEST
-
-############################################################
-# Handler specific properties.
-# Describes specific configuration info for Handlers.
-############################################################
-
-# default file output is in user's home directory.
-java.util.logging.FileHandler.pattern = %h/java%u.log
-java.util.logging.FileHandler.limit = 50000
-java.util.logging.FileHandler.count = 1
-java.util.logging.FileHandler.formatter = java.util.logging.XMLFormatter
-
-# Limit the message that are printed on the console to INFO and above.
-java.util.logging.ConsoleHandler.level = INFO
-java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
-
-
-############################################################
-# Facility specific properties.
-# Provides extra control for each logger.
-############################################################
-
-# For example, set the com.xyz.foo logger to only log SEVERE
-# messages:
-com.xyz.foo.level = SEVERE
-
-############################################################
-# HTTPClient
-############################################################
-.level=FINEST
-handlers=java.util.logging.ConsoleHandler
-java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
-java.util.logging.ConsoleHandler.level=FINEST
-
-org.apache.http.level = FINEST
-org.apache.http.wire.level = FINEST
-org.apache.http.impl.conn.level = FINEST
-org.apache.http.impl.conn.level = FINEST
-org.apache.http.impl.client.level = FINEST
-org.apache.http.client.level = FINEST
\ No newline at end of file
diff --git a/gateway-service-hashicorp-vault/src/test/resources/log4j.properties b/gateway-service-hashicorp-vault/src/test/resources/log4j.properties
deleted file mode 100644
index e8643cd..0000000
--- a/gateway-service-hashicorp-vault/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,24 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# Root logger option
-log4j.rootLogger=INFO, stdout
-
-# Direct log messages to stdout
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.Target=System.out
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
diff --git a/gateway-service-hashicorp-vault/src/test/resources/log4j2.xml b/gateway-service-hashicorp-vault/src/test/resources/log4j2.xml
new file mode 100644
index 0000000..b91f3c0
--- /dev/null
+++ b/gateway-service-hashicorp-vault/src/test/resources/log4j2.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<Configuration>
+    <Appenders>
+        <Console name="stdout" target="SYSTEM_OUT">
+            <PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n" />
+        </Console>
+    </Appenders>
+    <Loggers>
+        <Root level="info">
+            <AppenderRef ref="stdout"/>
+        </Root>
+    </Loggers>
+</Configuration>
diff --git a/gateway-service-nifi-registry/pom.xml b/gateway-service-nifi-registry/pom.xml
index 2d022d2..81c137e 100644
--- a/gateway-service-nifi-registry/pom.xml
+++ b/gateway-service-nifi-registry/pom.xml
@@ -62,11 +62,6 @@
         </dependency>
 
         <dependency>
-            <groupId>log4j</groupId>
-            <artifactId>log4j</artifactId>
-        </dependency>
-
-        <dependency>
             <groupId>javax.servlet</groupId>
             <artifactId>javax.servlet-api</artifactId>
         </dependency>
diff --git a/gateway-service-nifi/pom.xml b/gateway-service-nifi/pom.xml
index bb4a126..437c73b 100644
--- a/gateway-service-nifi/pom.xml
+++ b/gateway-service-nifi/pom.xml
@@ -58,8 +58,8 @@
         </dependency>
 
         <dependency>
-            <groupId>log4j</groupId>
-            <artifactId>log4j</artifactId>
+            <groupId>org.apache.logging.log4j</groupId>
+            <artifactId>log4j-api</artifactId>
         </dependency>
 
         <dependency>
diff --git a/gateway-service-nifi/src/main/java/org/apache/knox/gateway/dispatch/NiFiRequestUtil.java b/gateway-service-nifi/src/main/java/org/apache/knox/gateway/dispatch/NiFiRequestUtil.java
index 8c45123..86adcdb 100644
--- a/gateway-service-nifi/src/main/java/org/apache/knox/gateway/dispatch/NiFiRequestUtil.java
+++ b/gateway-service-nifi/src/main/java/org/apache/knox/gateway/dispatch/NiFiRequestUtil.java
@@ -22,7 +22,7 @@ import org.apache.http.Header;
 import org.apache.http.client.methods.HttpUriRequest;
 import org.apache.http.client.methods.RequestBuilder;
 import org.apache.knox.gateway.security.SubjectUtils;
-import org.apache.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
 
 import javax.security.auth.Subject;
 import javax.servlet.http.HttpServletRequest;
@@ -60,7 +60,7 @@ class NiFiRequestUtil {
         if (index >= 0) {
           knoxRouteContext = inboundRequestPathInfo.substring(0, index);
         } else {
-          Logger.getLogger(NiFiRequestUtil.class.getName()).error(String.format(Locale.ROOT, "Unable to find index of %s in %s", outboundRequestUriPathNoTrailingSlash, inboundRequestPathInfo));
+          LogManager.getLogger(NiFiRequestUtil.class.getName()).error(String.format(Locale.ROOT, "Unable to find index of %s in %s", outboundRequestUriPathNoTrailingSlash, inboundRequestPathInfo));
         }
         outboundRequest.setHeader(NiFiHeaders.X_FORWARDED_CONTEXT, xForwardedContextHeaderValue + knoxRouteContext);
       }
diff --git a/gateway-service-remoteconfig/src/test/java/org/apache/knox/gateway/service/config/remote/zk/RemoteConfigurationRegistryClientServiceTestBase.java b/gateway-service-remoteconfig/src/test/java/org/apache/knox/gateway/service/config/remote/zk/RemoteConfigurationRegistryClientServiceTestBase.java
index 3efda8d..9a1c6b9 100644
--- a/gateway-service-remoteconfig/src/test/java/org/apache/knox/gateway/service/config/remote/zk/RemoteConfigurationRegistryClientServiceTestBase.java
+++ b/gateway-service-remoteconfig/src/test/java/org/apache/knox/gateway/service/config/remote/zk/RemoteConfigurationRegistryClientServiceTestBase.java
@@ -53,7 +53,6 @@ public class RemoteConfigurationRegistryClientServiceTestBase {
      */
     protected TestingCluster setupAndStartSecureTestZooKeeper(String principal, String digestPassword) throws Exception {
         final boolean applyAuthentication = (principal != null);
-
         // Configure security for the ZK cluster instances
         Map<String, Object> customInstanceSpecProps = new HashMap<>();
         customInstanceSpecProps.put("admin.enableServer", false);
diff --git a/gateway-shell-launcher/src/main/resources/META-INF/launcher.cfg b/gateway-shell-launcher/src/main/resources/META-INF/launcher.cfg
index c9cc31d..4784c5f 100644
--- a/gateway-shell-launcher/src/main/resources/META-INF/launcher.cfg
+++ b/gateway-shell-launcher/src/main/resources/META-INF/launcher.cfg
@@ -15,4 +15,4 @@
 main.class = org.apache.knox.gateway.shell.Shell
 class.path = ../lib/*.jar;../dep/*.jar;../ext;../ext/*.jar
 GATEWAY_HOME=${launcher.dir}/..
-log4j.configuration=${GATEWAY_HOME}/conf/${launcher.name}-log4j.properties
\ No newline at end of file
+log4j.configurationFile=${GATEWAY_HOME}/conf/${launcher.name}-log4j2.xml
\ No newline at end of file
diff --git a/gateway-shell-release/home/bin/knoxshell.sh b/gateway-shell-release/home/bin/knoxshell.sh
index b31681c..14cea81 100755
--- a/gateway-shell-release/home/bin/knoxshell.sh
+++ b/gateway-shell-release/home/bin/knoxshell.sh
@@ -81,7 +81,7 @@ function main {
 
    checkJava
    buildAppJavaOpts
-   $JAVA "${APP_JAVA_OPTS[@]}" -Dlog4j.configuration=conf/knoxshell-log4j.properties -javaagent:"$APP_BIN_DIR"/../lib/aspectjweaver.jar -cp "$APP_JAR":lib/* org.apache.knox.gateway.shell.Shell "$@" || exit 1
+   $JAVA "${APP_JAVA_OPTS[@]}" -Dlog4j.configurationFile=conf/knoxshell-log4j2.xml -javaagent:"$APP_BIN_DIR"/../lib/aspectjweaver.jar -cp "$APP_JAR":lib/* org.apache.knox.gateway.shell.Shell "$@" || exit 1
 
    return 0
 }
diff --git a/gateway-shell-release/home/conf/knoxshell-log4j.properties b/gateway-shell-release/home/conf/knoxshell-log4j.properties
deleted file mode 100644
index cac3d99..0000000
--- a/gateway-shell-release/home/conf/knoxshell-log4j.properties
+++ /dev/null
@@ -1,35 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-app.log.dir=logs
-app.log.file=${launcher.name}.log
-
-log4j.rootLogger=ERROR, drfa
-
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d{yy/MM/dd HH:mm:ss} %p %c{2}: %m%n
-
-log4j.appender.drfa=org.apache.log4j.DailyRollingFileAppender
-log4j.appender.drfa.File=${app.log.dir}/${app.log.file}
-log4j.appender.drfa.DatePattern=.yyyy-MM-dd
-log4j.appender.drfa.layout=org.apache.log4j.PatternLayout
-log4j.appender.drfa.layout.ConversionPattern=%d{ISO8601} %-5p %c{2} (%F:%M(%L)) - %m%n
-
-
-log4j.logger.org.apache.http.impl.conn=INFO
-log4j.logger.org.apache.http.impl.client=INFO
-log4j.logger.org.apache.http.client=INFO
\ No newline at end of file
diff --git a/gateway-shell-release/home/conf/knoxshell-log4j2.xml b/gateway-shell-release/home/conf/knoxshell-log4j2.xml
new file mode 100644
index 0000000..c8ed33c
--- /dev/null
+++ b/gateway-shell-release/home/conf/knoxshell-log4j2.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<?xml version="1.0" encoding="utf-8"?>
+<Configuration>
+    <Properties>
+        <Property name="app.log.dir">logs</Property>
+        <Property name="app.log.file">${sys:launcher.name}.log</Property>
+    </Properties>
+    <Appenders>
+        <Console name="stdout" target="SYSTEM_OUT">
+            <PatternLayout pattern="%d{yy/MM/dd HH:mm:ss} %p %c{2}: %m%n" />
+        </Console>
+        <RollingFile name="drfa" fileName="${app.log.dir}/${app.log.file}" filePattern="${app.log.dir}/${app.log.file}.%d{yyyy-MM-dd}">
+            <PatternLayout pattern="%d{ISO8601} %-5p %c{2} (%F:%M(%L)) - %m%n" />
+            <TimeBasedTriggeringPolicy />
+        </RollingFile>
+    </Appenders>
+    <Loggers>
+        <Logger name="org.apache.http.impl.client" level="INFO" />
+        <Logger name="org.apache.http.client" level="INFO" />
+        <Logger name="org.apache.http.impl.conn" level="INFO" />
+        <Root level="ERROR">
+            <AppenderRef ref="drfa" />
+        </Root>
+    </Loggers>
+</Configuration>
\ No newline at end of file
diff --git a/gateway-shell/pom.xml b/gateway-shell/pom.xml
index b7e6837..67f065d 100644
--- a/gateway-shell/pom.xml
+++ b/gateway-shell/pom.xml
@@ -107,10 +107,6 @@
             <artifactId>commons-configuration</artifactId>
         </dependency>
         <dependency>
-            <groupId>log4j</groupId>
-            <artifactId>log4j</artifactId>
-        </dependency>
-        <dependency>
             <groupId>de.thetaphi</groupId>
             <artifactId>forbiddenapis</artifactId>
         </dependency>
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/Shell.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/Shell.java
index c4a0be6..782d910 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/Shell.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/Shell.java
@@ -31,7 +31,6 @@ import org.apache.knox.gateway.shell.manager.Manager;
 import org.apache.knox.gateway.shell.table.KnoxShellTable;
 import org.apache.knox.gateway.shell.workflow.Workflow;
 import org.apache.knox.gateway.shell.yarn.Yarn;
-import org.apache.log4j.PropertyConfigurator;
 import org.codehaus.groovy.tools.shell.AnsiDetector;
 import org.codehaus.groovy.tools.shell.Groovysh;
 import org.fusesource.jansi.Ansi;
@@ -65,7 +64,6 @@ public class Shell {
 
   @SuppressWarnings("PMD.DoNotUseThreads") // we need to define a Thread to be able to register a shutdown hook
   public static void main( String... args ) throws Exception {
-    PropertyConfigurator.configure( System.getProperty( "log4j.configuration" ) );
     if( args.length > 0 ) {
       if (NON_INTERACTIVE_COMMANDS.contains(args[0])) {
           final String[] arguments = new String[args.length == 1 ? 1:3];
diff --git a/gateway-test-release-utils/pom.xml b/gateway-test-release-utils/pom.xml
index 38476db..f85bbb8 100644
--- a/gateway-test-release-utils/pom.xml
+++ b/gateway-test-release-utils/pom.xml
@@ -65,8 +65,8 @@
         </dependency>
 
         <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-api</artifactId>
+            <groupId>org.apache.logging.log4j</groupId>
+            <artifactId>log4j-api</artifactId>
             <scope>provided</scope>
         </dependency>
 
diff --git a/gateway-test-release-utils/src/main/java/org/apache/knox/gateway/GatewayTestDriver.java b/gateway-test-release-utils/src/main/java/org/apache/knox/gateway/GatewayTestDriver.java
index 0019e50..9912d7d 100644
--- a/gateway-test-release-utils/src/main/java/org/apache/knox/gateway/GatewayTestDriver.java
+++ b/gateway-test-release-utils/src/main/java/org/apache/knox/gateway/GatewayTestDriver.java
@@ -45,10 +45,10 @@ import org.apache.knox.gateway.security.ldap.SimpleLdapDirectoryServer;
 import org.apache.knox.gateway.services.DefaultGatewayServices;
 import org.apache.knox.gateway.services.ServiceLifecycleException;
 import org.apache.knox.test.mock.MockServer;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 import org.hamcrest.CoreMatchers;
 import org.hamcrest.Matchers;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 import com.mycila.xmltool.XMLTag;
 
@@ -61,7 +61,7 @@ import com.mycila.xmltool.XMLTag;
  * 4) Provides methods to access test resources.
  */
 public class GatewayTestDriver {
-  private static final Logger log = LoggerFactory.getLogger( GatewayTestDriver.class );
+  private static final Logger log = LogManager.getLogger( GatewayTestDriver.class );
 
   public Class<?> resourceBaseClass;
   public Map<String,Service> services = new HashMap<>();
diff --git a/gateway-test-release/pom.xml b/gateway-test-release/pom.xml
index b3387e8..1df0b31 100644
--- a/gateway-test-release/pom.xml
+++ b/gateway-test-release/pom.xml
@@ -182,6 +182,14 @@
                     <groupId>org.eclipse.jetty</groupId>
                     <artifactId>jetty-util</artifactId>
                 </exclusion>
+                <exclusion>
+                    <groupId>org.slf4j</groupId>
+                    <artifactId>slf4j-api</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.slf4j</groupId>
+                    <artifactId>slf4j-log4j12</artifactId>
+                </exclusion>
             </exclusions>
             <scope>test</scope>
         </dependency>
@@ -217,12 +225,40 @@
             <version>${hadoop.version}</version>
             <type>test-jar</type>
             <scope>test</scope>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.slf4j</groupId>
+                    <artifactId>slf4j-api</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.slf4j</groupId>
+                    <artifactId>slf4j-log4j12</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>log4j</groupId>
+                    <artifactId>log4j</artifactId>
+                </exclusion>
+            </exclusions>
         </dependency>
         <dependency>
             <groupId>org.apache.hadoop</groupId>
             <artifactId>hadoop-hdfs</artifactId>
             <version>${hadoop.version}</version>
             <scope>test</scope>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.slf4j</groupId>
+                    <artifactId>slf4j-api</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.slf4j</groupId>
+                    <artifactId>slf4j-log4j12</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>log4j</groupId>
+                    <artifactId>log4j</artifactId>
+                </exclusion>
+            </exclusions>
         </dependency>
         <dependency>
             <groupId>org.apache.hadoop</groupId>
@@ -234,6 +270,12 @@
             <artifactId>hadoop-minikdc</artifactId>
             <version>${hadoop.version}</version>
             <scope>test</scope>
+            <exclusions>
+                <exclusion>
+                    <groupId>log4j</groupId>
+                    <artifactId>log4j</artifactId>
+                </exclusion>
+            </exclusions>
         </dependency>
 
         <dependency>
@@ -241,12 +283,6 @@
              <artifactId>guava</artifactId>
              <scope>test</scope>
         </dependency>
-        
-        <dependency>
-            <groupId>log4j</groupId>
-            <artifactId>log4j</artifactId>
-            <scope>test</scope>
-        </dependency>
 
         <dependency>
             <groupId>org.apache.knox</groupId>
diff --git a/gateway-test-release/webhdfs-kerb-test/src/test/java/org/apache/knox/gateway/SecureClusterTest.java b/gateway-test-release/webhdfs-kerb-test/src/test/java/org/apache/knox/gateway/SecureClusterTest.java
index 1878653..c3f59b1 100644
--- a/gateway-test-release/webhdfs-kerb-test/src/test/java/org/apache/knox/gateway/SecureClusterTest.java
+++ b/gateway-test-release/webhdfs-kerb-test/src/test/java/org/apache/knox/gateway/SecureClusterTest.java
@@ -41,7 +41,6 @@ import org.apache.http.message.BasicHttpRequest;
 import org.apache.http.util.EntityUtils;
 import org.apache.knox.test.TestUtils;
 import org.apache.knox.test.category.ReleaseTest;
-import org.apache.log4j.PropertyConfigurator;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -190,7 +189,6 @@ public class SecureClusterTest {
 
   @Test
   public void basicGetUserHomeRequest() throws Exception {
-    setupLogging();
     CloseableHttpClient client = getHttpClient();
     String method = "GET";
     String uri = driver.getClusterUrl() + "/webhdfs/v1?op=GETHOMEDIRECTORY";
@@ -221,10 +219,6 @@ public class SecureClusterTest {
         .build();
   }
 
-  private static void setupLogging() {
-    PropertyConfigurator.configure(ClassLoader.getSystemResource("log4j.properties"));
-  }
-
   private static File setupJaasConf(File baseDir, String keyTabFile, String principal) throws IOException {
     File file = new File(baseDir, "jaas.conf");
     if (!file.exists()) {
diff --git a/gateway-test-release/webhdfs-kerb-test/src/test/java/org/apache/knox/gateway/SecureKnoxShellTest.java b/gateway-test-release/webhdfs-kerb-test/src/test/java/org/apache/knox/gateway/SecureKnoxShellTest.java
index 9e46ff9..3e72780 100644
--- a/gateway-test-release/webhdfs-kerb-test/src/test/java/org/apache/knox/gateway/SecureKnoxShellTest.java
+++ b/gateway-test-release/webhdfs-kerb-test/src/test/java/org/apache/knox/gateway/SecureKnoxShellTest.java
@@ -31,7 +31,6 @@ import org.apache.hadoop.security.UserGroupInformation;
 import org.apache.hadoop.security.ssl.KeyStoreTestUtil;
 import org.apache.knox.test.TestUtils;
 import org.apache.knox.test.category.ReleaseTest;
-import org.apache.log4j.PropertyConfigurator;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -273,15 +272,8 @@ public class SecureKnoxShellTest {
         .gotoParent().gotoRoot();
   }
 
-  private static void setupLogging() {
-    PropertyConfigurator
-        .configure(ClassLoader.getSystemResource("log4j.properties"));
-  }
-
   @Test
   public void testCachedTicket() throws Exception {
-    setupLogging();
-
     webhdfsPutGet();
   }
 
@@ -309,7 +301,7 @@ public class SecureKnoxShellTest {
 
     final GroovyShell shell = new GroovyShell(binding);
 
-    shell.evaluate(getResourceUrl(SCRIPT).toURI());
+    shell.evaluate(TestUtils.getResourceUrl(SCRIPT).toURI());
 
     String status = (String) binding.getProperty("status");
     assertNotNull(status);
@@ -318,11 +310,4 @@ public class SecureKnoxShellTest {
     assertNotNull(fetchedFile);
     assertTrue(fetchedFile.contains("README"));
   }
-
-  public URL getResourceUrl(String resource) {
-    String filePath =
-        this.getClass().getCanonicalName().replaceAll("\\.", "/") + "/"
-            + resource;
-    return ClassLoader.getSystemResource(filePath);
-  }
 }
diff --git a/gateway-test-release/webhdfs-test/src/test/java/org/apache/knox/gateway/ShellTest.java b/gateway-test-release/webhdfs-test/src/test/java/org/apache/knox/gateway/ShellTest.java
index 05403d7..3885c31 100644
--- a/gateway-test-release/webhdfs-test/src/test/java/org/apache/knox/gateway/ShellTest.java
+++ b/gateway-test-release/webhdfs-test/src/test/java/org/apache/knox/gateway/ShellTest.java
@@ -37,7 +37,6 @@ import org.apache.hadoop.hdfs.MiniDFSCluster;
 import org.apache.hadoop.security.UserGroupInformation;
 import org.apache.hadoop.security.ssl.KeyStoreTestUtil;
 import org.apache.knox.test.TestUtils;
-import org.apache.log4j.PropertyConfigurator;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -98,7 +97,6 @@ public class ShellTest {
   }
 
   private void testPutGetScript(String script) throws IOException, URISyntaxException {
-    setupLogging();
     DistributedFileSystem fileSystem = miniDFSCluster.getFileSystem();
     Path dir = new Path("/user/guest/example");
     fileSystem.delete(dir, true);
@@ -123,10 +121,6 @@ public class ShellTest {
     testPutGetScript("WebHdfsPutGet.groovy");
   }
 
-  private static void setupLogging() {
-    PropertyConfigurator.configure(ClassLoader.getSystemResource("log4j.properties"));
-  }
-
   /**
    * Creates a topology that is deployed to the gateway instance for the test suite.
    * Note that this topology is shared by all of the test methods in this suite.
diff --git a/gateway-test-utils/pom.xml b/gateway-test-utils/pom.xml
index 0d64774..efc96b4 100644
--- a/gateway-test-utils/pom.xml
+++ b/gateway-test-utils/pom.xml
@@ -57,13 +57,13 @@
         </dependency>
 
         <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-api</artifactId>
+            <groupId>org.apache.logging.log4j</groupId>
+            <artifactId>log4j-api</artifactId>
             <scope>provided</scope>
         </dependency>
         <dependency>
-            <groupId>log4j</groupId>
-            <artifactId>log4j</artifactId>
+            <groupId>org.apache.logging.log4j</groupId>
+            <artifactId>log4j-core</artifactId>
             <scope>provided</scope>
         </dependency>
 
diff --git a/gateway-test-utils/src/main/java/org/apache/knox/test/TestUtils.java b/gateway-test-utils/src/main/java/org/apache/knox/test/TestUtils.java
index dcf87b5..fee2ecb 100644
--- a/gateway-test-utils/src/main/java/org/apache/knox/test/TestUtils.java
+++ b/gateway-test-utils/src/main/java/org/apache/knox/test/TestUtils.java
@@ -19,7 +19,8 @@ package org.apache.knox.test;
 
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.io.IOUtils;
-import org.apache.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 import org.apache.velocity.Template;
 import org.apache.velocity.VelocityContext;
 import org.apache.velocity.app.VelocityEngine;
@@ -50,7 +51,7 @@ import java.util.concurrent.Callable;
 import java.util.concurrent.TimeUnit;
 
 public class TestUtils {
-  private static final Logger LOG = Logger.getLogger(TestUtils.class);
+  private static final Logger LOG = LogManager.getLogger(TestUtils.class);
 
   public static final long SHORT_TIMEOUT = 5000L;
   public static final long MEDIUM_TIMEOUT = 30 * 1000L;
diff --git a/gateway-test-utils/src/main/java/org/apache/knox/test/log/CollectAppender.java b/gateway-test-utils/src/main/java/org/apache/knox/test/log/CollectAppender.java
index 14bbe05..c889795 100644
--- a/gateway-test-utils/src/main/java/org/apache/knox/test/log/CollectAppender.java
+++ b/gateway-test-utils/src/main/java/org/apache/knox/test/log/CollectAppender.java
@@ -17,34 +17,40 @@
  */
 package org.apache.knox.test.log;
 
+import org.apache.logging.log4j.core.Appender;
+import org.apache.logging.log4j.core.Core;
+import org.apache.logging.log4j.core.Filter;
+import org.apache.logging.log4j.core.LogEvent;
+import org.apache.logging.log4j.core.appender.AbstractAppender;
+import org.apache.logging.log4j.core.config.Property;
+import org.apache.logging.log4j.core.config.plugins.Plugin;
+import org.apache.logging.log4j.core.config.plugins.PluginAttribute;
+import org.apache.logging.log4j.core.config.plugins.PluginElement;
+import org.apache.logging.log4j.core.config.plugins.PluginFactory;
+
 import java.util.concurrent.BlockingQueue;
 import java.util.concurrent.LinkedBlockingQueue;
 
-import org.apache.log4j.AppenderSkeleton;
-import org.apache.log4j.spi.LoggingEvent;
-
-public class CollectAppender extends AppenderSkeleton {
-
-  public CollectAppender() {
-    super();
-  }
-
-  public static final BlockingQueue<LoggingEvent> queue = new LinkedBlockingQueue<>();
+@Plugin(
+    name = "CollectAppender",
+    category = Core.CATEGORY_NAME,
+    elementType = Appender.ELEMENT_TYPE)
+public class CollectAppender extends AbstractAppender {
+  public static final BlockingQueue<LogEvent> queue = new LinkedBlockingQueue<>();
 
-  @Override
-  protected void append( LoggingEvent event ) {
-    event.getProperties();
-    queue.add( event );
+  private CollectAppender(String name, Filter filter) {
+    super(name, filter, null, false, Property.EMPTY_ARRAY);
   }
 
-  @Override
-  public void close() {
-    closed = true;
+  @PluginFactory
+  public static CollectAppender createAppender(
+      @PluginAttribute("name") String name,
+      @PluginElement("Filter") Filter filter) {
+    return new CollectAppender(name, filter);
   }
 
   @Override
-  public boolean requiresLayout() {
-    return false;
+  public void append(LogEvent event) {
+    queue.add( event );
   }
-
 }
\ No newline at end of file
diff --git a/gateway-test-utils/src/main/java/org/apache/knox/test/log/NoOpAppender.java b/gateway-test-utils/src/main/java/org/apache/knox/test/log/NoOpAppender.java
deleted file mode 100644
index ae2242c..0000000
--- a/gateway-test-utils/src/main/java/org/apache/knox/test/log/NoOpAppender.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.knox.test.log;
-
-import org.apache.log4j.Appender;
-import org.apache.log4j.Layout;
-import org.apache.log4j.Logger;
-import org.apache.log4j.spi.ErrorHandler;
-import org.apache.log4j.spi.Filter;
-import org.apache.log4j.spi.LoggingEvent;
-
-import java.util.Enumeration;
-
-public class NoOpAppender implements Appender {
-
-  public static Enumeration<Appender> setUpAndReturnOriginalAppenders() {
-    Enumeration<Appender> appenders = (Enumeration<Appender>)Logger.getRootLogger().getAllAppenders();
-    Logger.getRootLogger().removeAllAppenders();
-    Logger.getRootLogger().addAppender( new NoOpAppender() );
-    return appenders;
-  }
-
-  public static void resetOriginalAppenders(Enumeration<Appender> appenders ) {
-    if( appenders != null ) {
-      while( appenders.hasMoreElements() ) {
-        Logger.getRootLogger().addAppender( appenders.nextElement() );
-      }
-    }
-  }
-
-  @Override
-  public void addFilter( Filter newFilter ) {
-  }
-
-  @Override
-  public Filter getFilter() {
-    return null;
-  }
-
-  @Override
-  public void clearFilters() {
-  }
-
-  @Override
-  public void close() {
-  }
-
-  @Override
-  public void doAppend( LoggingEvent event ) {
-  }
-
-  @Override
-  public String getName() {
-    return this.getClass().getName();
-  }
-
-  @Override
-  public void setErrorHandler( ErrorHandler errorHandler ) {
-  }
-
-  @Override
-  public ErrorHandler getErrorHandler() {
-    return null;
-  }
-
-  @Override
-  public void setLayout( Layout layout ) {
-  }
-
-  @Override
-  public Layout getLayout() {
-    return null;
-  }
-
-  @Override
-  public void setName( String name ) {
-  }
-
-  @Override
-  public boolean requiresLayout() {
-    return false;
-  }
-}
diff --git a/gateway-test-utils/src/main/java/org/apache/knox/test/mock/MockServer.java b/gateway-test-utils/src/main/java/org/apache/knox/test/mock/MockServer.java
index 6808d66..a5f8cec 100644
--- a/gateway-test-utils/src/main/java/org/apache/knox/test/mock/MockServer.java
+++ b/gateway-test-utils/src/main/java/org/apache/knox/test/mock/MockServer.java
@@ -17,12 +17,12 @@
  */
 package org.apache.knox.test.mock;
 
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 import org.eclipse.jetty.server.Handler;
 import org.eclipse.jetty.server.Server;
 import org.eclipse.jetty.servlet.ServletContextHandler;
 import org.eclipse.jetty.servlet.ServletHolder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 import javax.servlet.Servlet;
 import java.util.LinkedList;
@@ -44,7 +44,7 @@ import java.util.Queue;
  * The whole idea was modeled after how the REST testing framework REST-assured and aims to be a server side equivalent.
  */
 public class MockServer {
-  private static final Logger log = LoggerFactory.getLogger( MockServer.class );
+  private static final Logger log = LogManager.getLogger( MockServer.class );
 
   private String name;
   private Server jetty;
diff --git a/gateway-test-utils/src/main/java/org/apache/knox/test/mock/MockServlet.java b/gateway-test-utils/src/main/java/org/apache/knox/test/mock/MockServlet.java
index 1818e25..f4ff29a 100644
--- a/gateway-test-utils/src/main/java/org/apache/knox/test/mock/MockServlet.java
+++ b/gateway-test-utils/src/main/java/org/apache/knox/test/mock/MockServlet.java
@@ -17,6 +17,9 @@
  */
 package org.apache.knox.test.mock;
 
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
@@ -24,12 +27,11 @@ import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.util.Queue;
 
-import org.apache.log4j.Logger;
 
 import static org.junit.Assert.fail;
 
 public class MockServlet extends HttpServlet {
-  private static final Logger LOG = Logger.getLogger(MockServlet.class);
+  private static final Logger LOG = LogManager.getLogger(MockServlet.class);
 
   private final String name;
   private final Queue<MockInteraction> interactions;
diff --git a/gateway-test/pom.xml b/gateway-test/pom.xml
index fe640a5..347af29 100644
--- a/gateway-test/pom.xml
+++ b/gateway-test/pom.xml
@@ -274,8 +274,13 @@
             <scope>test</scope>
         </dependency>
         <dependency>
-            <groupId>log4j</groupId>
-            <artifactId>log4j</artifactId>
+            <groupId>org.apache.logging.log4j</groupId>
+            <artifactId>log4j-api</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.logging.log4j</groupId>
+            <artifactId>log4j-core</artifactId>
             <scope>test</scope>
         </dependency>
 
diff --git a/gateway-test/src/test/java/org/apache/knox/gateway/AmbariServiceDefinitionTest.java b/gateway-test/src/test/java/org/apache/knox/gateway/AmbariServiceDefinitionTest.java
index d046c50..d3d14d8 100644
--- a/gateway-test/src/test/java/org/apache/knox/gateway/AmbariServiceDefinitionTest.java
+++ b/gateway-test/src/test/java/org/apache/knox/gateway/AmbariServiceDefinitionTest.java
@@ -26,6 +26,8 @@ import org.apache.knox.gateway.services.topology.TopologyService;
 import org.apache.knox.test.TestUtils;
 import org.apache.knox.test.mock.MockServer;
 import org.apache.http.HttpStatus;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 import org.apache.velocity.Template;
 import org.apache.velocity.VelocityContext;
 import org.apache.velocity.app.VelocityEngine;
@@ -37,8 +39,6 @@ import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.BeforeClass;
 import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 import java.io.File;
 import java.io.StringWriter;
@@ -56,7 +56,7 @@ import static uk.co.datumedge.hamcrest.json.SameJSONAs.sameJSONAs;
 
 public class AmbariServiceDefinitionTest {
 
-  private static Logger LOG = LoggerFactory.getLogger( AmbariServiceDefinitionTest.class );
+  private static Logger LOG = LogManager.getLogger( AmbariServiceDefinitionTest.class );
   private static Class<?> DAT = AmbariServiceDefinitionTest.class;
 
   private static GatewayTestConfig config;
diff --git a/gateway-test/src/test/java/org/apache/knox/gateway/GatewayAdminFuncTest.java b/gateway-test/src/test/java/org/apache/knox/gateway/GatewayAdminFuncTest.java
index 48a5406..a21972a 100644
--- a/gateway-test/src/test/java/org/apache/knox/gateway/GatewayAdminFuncTest.java
+++ b/gateway-test/src/test/java/org/apache/knox/gateway/GatewayAdminFuncTest.java
@@ -24,12 +24,12 @@ import org.apache.knox.gateway.services.DefaultGatewayServices;
 import org.apache.knox.gateway.services.ServiceLifecycleException;
 import org.apache.knox.test.TestUtils;
 import org.apache.http.HttpStatus;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 import org.hamcrest.MatcherAssert;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 import javax.ws.rs.core.MediaType;
 import java.io.File;
@@ -44,7 +44,7 @@ import static org.hamcrest.CoreMatchers.notNullValue;
 import static org.hamcrest.Matchers.is;
 
 public class GatewayAdminFuncTest {
-  private static final Logger LOG = LoggerFactory.getLogger( GatewayAdminFuncTest.class );
+  private static final Logger LOG = LogManager.getLogger( GatewayAdminFuncTest.class );
 
   public static GatewayConfig config;
   public static GatewayServer gateway;
diff --git a/gateway-test/src/test/java/org/apache/knox/gateway/GatewayAdminTopologyFuncTest.java b/gateway-test/src/test/java/org/apache/knox/gateway/GatewayAdminTopologyFuncTest.java
index 4fe6f6a..df3b8ba 100644
--- a/gateway-test/src/test/java/org/apache/knox/gateway/GatewayAdminTopologyFuncTest.java
+++ b/gateway-test/src/test/java/org/apache/knox/gateway/GatewayAdminTopologyFuncTest.java
@@ -52,11 +52,11 @@ import org.apache.commons.io.FileUtils;
 import org.apache.commons.io.FilenameUtils;
 import org.apache.knox.test.TestUtils;
 import org.apache.http.HttpStatus;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.w3c.dom.Document;
 import org.xml.sax.InputSource;
 
@@ -79,7 +79,7 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.fail;
 
 public class GatewayAdminTopologyFuncTest {
-  private static final Logger LOG = LoggerFactory.getLogger( GatewayAdminTopologyFuncTest.class );
+  private static final Logger LOG = LogManager.getLogger( GatewayAdminTopologyFuncTest.class );
 
   public static GatewayConfig config;
   public static GatewayServer gateway;
diff --git a/gateway-test/src/test/java/org/apache/knox/gateway/GatewayAppFuncTest.java b/gateway-test/src/test/java/org/apache/knox/gateway/GatewayAppFuncTest.java
index 48e7e86..65e9160 100644
--- a/gateway-test/src/test/java/org/apache/knox/gateway/GatewayAppFuncTest.java
+++ b/gateway-test/src/test/java/org/apache/knox/gateway/GatewayAppFuncTest.java
@@ -34,12 +34,12 @@ import org.apache.knox.gateway.services.topology.TopologyService;
 import org.apache.knox.test.TestUtils;
 import org.apache.knox.test.mock.MockServer;
 import org.apache.http.HttpStatus;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 import org.junit.After;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 import static io.restassured.RestAssured.given;
 import static org.apache.knox.test.TestUtils.LOG_ENTER;
@@ -56,7 +56,7 @@ import static org.xmlmatchers.xpath.HasXPath.hasXPath;
 import static uk.co.datumedge.hamcrest.json.SameJSONAs.sameJSONAs;
 
 public class GatewayAppFuncTest {
-  private static final Logger LOG = LoggerFactory.getLogger( GatewayAppFuncTest.class );
+  private static final Logger LOG = LogManager.getLogger( GatewayAppFuncTest.class );
   private static final Class<?> DAT = GatewayAppFuncTest.class;
 
   private static GatewayTestConfig config;
diff --git a/gateway-test/src/test/java/org/apache/knox/gateway/GatewayBasicFuncTest.java b/gateway-test/src/test/java/org/apache/knox/gateway/GatewayBasicFuncTest.java
index d395427..3f413ad 100644
--- a/gateway-test/src/test/java/org/apache/knox/gateway/GatewayBasicFuncTest.java
+++ b/gateway-test/src/test/java/org/apache/knox/gateway/GatewayBasicFuncTest.java
@@ -55,6 +55,8 @@ import org.apache.knox.test.TestUtils;
 import org.apache.knox.test.category.MediumTests;
 import org.apache.knox.test.category.VerifyTest;
 import org.apache.knox.test.mock.MockRequestMatcher;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 import org.apache.velocity.Template;
 import org.apache.velocity.VelocityContext;
 import org.apache.velocity.app.VelocityEngine;
@@ -70,8 +72,6 @@ import org.junit.Assume;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 import javax.ws.rs.core.MediaType;
 import java.io.ByteArrayOutputStream;
@@ -114,7 +114,7 @@ import static uk.co.datumedge.hamcrest.json.SameJSONAs.sameJSONAs;
 
 @Category( { VerifyTest.class, MediumTests.class } )
 public class GatewayBasicFuncTest {
-  private static Logger log = LoggerFactory.getLogger( GatewayBasicFuncTest.class );
+  private static final Logger log = LogManager.getLogger( GatewayBasicFuncTest.class );
 
   private static GatewayTestDriver driver = new GatewayTestDriver();
 
@@ -366,7 +366,7 @@ public class GatewayBasicFuncTest {
   }
 
   @Test( timeout = TestUtils.MEDIUM_TIMEOUT )
-  public void testBasicOutboundEncodedHeaderUseCase() throws IOException {
+  public void testBasicOutboundEncodedHeaderUseCase() {
     LOG_ENTER();
     String root = "/tmp/GatewayBasicFuncTest/testBasicOutboundHeaderUseCase";
     String username = "hdfs";
diff --git a/gateway-test/src/test/java/org/apache/knox/gateway/GatewayCorrelationIdTest.java b/gateway-test/src/test/java/org/apache/knox/gateway/GatewayCorrelationIdTest.java
index ad85bee..5522beb 100644
--- a/gateway-test/src/test/java/org/apache/knox/gateway/GatewayCorrelationIdTest.java
+++ b/gateway-test/src/test/java/org/apache/knox/gateway/GatewayCorrelationIdTest.java
@@ -21,18 +21,18 @@ import com.mycila.xmltool.XMLDoc;
 import com.mycila.xmltool.XMLTag;
 import org.apache.http.HttpStatus;
 import org.apache.knox.gateway.audit.api.CorrelationContext;
-import org.apache.knox.gateway.audit.log4j.correlation.Log4jCorrelationService;
+import org.apache.knox.gateway.audit.log4j.correlation.Log4jCorrelationContext;
 import org.apache.knox.gateway.config.GatewayConfig;
 import org.apache.knox.gateway.services.DefaultGatewayServices;
 import org.apache.knox.gateway.services.ServiceLifecycleException;
 import org.apache.knox.test.log.CollectAppender;
-import org.apache.log4j.spi.LoggingEvent;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.core.LogEvent;
 import org.hamcrest.MatcherAssert;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 import java.io.File;
 import java.io.OutputStream;
@@ -57,7 +57,7 @@ import static org.hamcrest.CoreMatchers.notNullValue;
 import static org.hamcrest.MatcherAssert.assertThat;
 
 public class GatewayCorrelationIdTest {
-  private static final Logger LOG = LoggerFactory.getLogger( GatewayCorrelationIdTest.class );
+  private static final Logger LOG = LogManager.getLogger( GatewayCorrelationIdTest.class );
 
   public static GatewayConfig config;
   public static GatewayServer gateway;
@@ -201,8 +201,8 @@ public class GatewayCorrelationIdTest {
 
     // Use a set to make sure to dedupe any requestIds to get only unique ones
     Set<String> requestIds = new HashSet<>();
-    for (LoggingEvent accessEvent : CollectAppender.queue) {
-      CorrelationContext cc = (CorrelationContext)accessEvent.getMDC( Log4jCorrelationService.MDC_CORRELATION_CONTEXT_KEY );
+    for (LogEvent accessEvent : CollectAppender.queue) {
+      CorrelationContext cc = Log4jCorrelationContext.of(accessEvent);
       // There are some events that do not have a CorrelationContext associated (ie: deploy)
       if(cc != null) {
         requestIds.add(cc.getRequestId());
@@ -210,7 +210,7 @@ public class GatewayCorrelationIdTest {
     }
 
     // There should be a unique correlation id for each request
-    assertThat(requestIds.size(), is(numberTotalRequests));
+    assertThat(numberTotalRequests, is(requestIds.size()));
 
     LOG_EXIT();
   }
diff --git a/gateway-test/src/test/java/org/apache/knox/gateway/GatewayDeployFuncTest.java b/gateway-test/src/test/java/org/apache/knox/gateway/GatewayDeployFuncTest.java
index d311b86..5adbdae 100644
--- a/gateway-test/src/test/java/org/apache/knox/gateway/GatewayDeployFuncTest.java
+++ b/gateway-test/src/test/java/org/apache/knox/gateway/GatewayDeployFuncTest.java
@@ -27,14 +27,14 @@ import org.apache.knox.gateway.services.ServiceLifecycleException;
 import org.apache.knox.test.TestUtils;
 import org.apache.knox.test.category.ReleaseTest;
 import org.apache.http.HttpStatus;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 import org.junit.After;
 import org.junit.AfterClass;
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 import java.io.File;
 import java.io.FilenameFilter;
@@ -57,7 +57,7 @@ import static org.hamcrest.Matchers.greaterThan;
 
 @Category(ReleaseTest.class)
 public class GatewayDeployFuncTest {
-  private static final Logger LOG = LoggerFactory.getLogger( GatewayDeployFuncTest.class );
+  private static final Logger LOG = LogManager.getLogger( GatewayDeployFuncTest.class );
 
   public static GatewayConfig config;
   public static GatewayServer gateway;
diff --git a/gateway-test/src/test/java/org/apache/knox/gateway/GatewayHealthFuncTest.java b/gateway-test/src/test/java/org/apache/knox/gateway/GatewayHealthFuncTest.java
index 552de97..aa9032a 100644
--- a/gateway-test/src/test/java/org/apache/knox/gateway/GatewayHealthFuncTest.java
+++ b/gateway-test/src/test/java/org/apache/knox/gateway/GatewayHealthFuncTest.java
@@ -27,13 +27,13 @@ import org.apache.knox.gateway.services.DefaultGatewayServices;
 import org.apache.knox.gateway.services.ServiceLifecycleException;
 import org.apache.knox.test.TestUtils;
 import org.apache.http.HttpStatus;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 import org.hamcrest.MatcherAssert;
 import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.BeforeClass;
 import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 import javax.ws.rs.core.MediaType;
 import java.io.File;
@@ -51,7 +51,7 @@ import static io.restassured.RestAssured.given;
 import static org.hamcrest.CoreMatchers.notNullValue;
 
 public class GatewayHealthFuncTest {
-  private static final Logger LOG = LoggerFactory.getLogger(GatewayAdminFuncTest.class);
+  private static final Logger LOG = LogManager.getLogger(GatewayAdminFuncTest.class);
 
   public static GatewayConfig config;
   public static GatewayServer gateway;
diff --git a/gateway-test/src/test/java/org/apache/knox/gateway/GatewayLocalServiceFuncTest.java b/gateway-test/src/test/java/org/apache/knox/gateway/GatewayLocalServiceFuncTest.java
index 07ed8f9..5643d5b 100644
--- a/gateway-test/src/test/java/org/apache/knox/gateway/GatewayLocalServiceFuncTest.java
+++ b/gateway-test/src/test/java/org/apache/knox/gateway/GatewayLocalServiceFuncTest.java
@@ -24,19 +24,16 @@ import org.apache.knox.gateway.config.GatewayConfig;
 import org.apache.knox.gateway.services.DefaultGatewayServices;
 import org.apache.knox.gateway.services.ServiceLifecycleException;
 import org.apache.knox.test.TestUtils;
-import org.apache.knox.test.log.NoOpAppender;
 import org.apache.http.HttpStatus;
-import org.apache.log4j.Appender;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 import java.io.File;
 import java.io.OutputStream;
 import java.nio.file.Files;
-import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.UUID;
@@ -49,9 +46,8 @@ import static org.hamcrest.CoreMatchers.notNullValue;
 import static org.hamcrest.MatcherAssert.assertThat;
 
 public class GatewayLocalServiceFuncTest {
-  private static final Logger LOG = LoggerFactory.getLogger( GatewayTestDriver.class );
+  private static final Logger LOG = LogManager.getLogger( GatewayTestDriver.class );
 
-  public static Enumeration<Appender> appenders;
   public static GatewayConfig config;
   public static GatewayServer gateway;
   public static String gatewayUrl;
@@ -61,7 +57,6 @@ public class GatewayLocalServiceFuncTest {
   @BeforeClass
   public static void setUpBeforeClass() throws Exception {
     LOG_ENTER();
-    appenders = NoOpAppender.setUpAndReturnOriginalAppenders();
     driver.setupLdap(0);
     setupGateway();
     LOG_EXIT();
@@ -74,7 +69,6 @@ public class GatewayLocalServiceFuncTest {
     driver.cleanup();
     FileUtils.deleteQuietly( new File( config.getGatewayConfDir() ) );
     FileUtils.deleteQuietly( new File( config.getGatewayDataDir() ) );
-    NoOpAppender.resetOriginalAppenders( appenders );
     LOG_EXIT();
   }
 
diff --git a/gateway-test/src/test/java/org/apache/knox/gateway/GatewayMultiFuncTest.java b/gateway-test/src/test/java/org/apache/knox/gateway/GatewayMultiFuncTest.java
index c03ec73..23ba008 100644
--- a/gateway-test/src/test/java/org/apache/knox/gateway/GatewayMultiFuncTest.java
+++ b/gateway-test/src/test/java/org/apache/knox/gateway/GatewayMultiFuncTest.java
@@ -40,12 +40,12 @@ import org.apache.knox.gateway.services.topology.TopologyService;
 import org.apache.knox.test.TestUtils;
 import org.apache.knox.test.category.ReleaseTest;
 import org.apache.knox.test.mock.MockServer;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 import java.io.File;
 import java.net.URL;
@@ -68,7 +68,7 @@ import static org.xmlmatchers.transform.XmlConverters.the;
 
 @Category(ReleaseTest.class)
 public class GatewayMultiFuncTest {
-  private static final Logger LOG = LoggerFactory.getLogger( GatewayMultiFuncTest.class );
+  private static final Logger LOG = LogManager.getLogger( GatewayMultiFuncTest.class );
   private static final Class<?> DAT = GatewayMultiFuncTest.class;
 
   private static GatewayTestConfig config;
diff --git a/gateway-test/src/test/java/org/apache/knox/gateway/GatewaySampleFuncTest.java b/gateway-test/src/test/java/org/apache/knox/gateway/GatewaySampleFuncTest.java
index 29dd829..5012c93 100644
--- a/gateway-test/src/test/java/org/apache/knox/gateway/GatewaySampleFuncTest.java
+++ b/gateway-test/src/test/java/org/apache/knox/gateway/GatewaySampleFuncTest.java
@@ -24,12 +24,12 @@ import org.apache.knox.gateway.services.DefaultGatewayServices;
 import org.apache.knox.gateway.services.ServiceLifecycleException;
 import org.apache.knox.test.TestUtils;
 import org.apache.http.HttpStatus;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 import org.hamcrest.MatcherAssert;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 import java.io.File;
 import java.io.OutputStream;
@@ -45,7 +45,7 @@ import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.CoreMatchers.notNullValue;
 
 public class GatewaySampleFuncTest {
-  private static final Logger LOG = LoggerFactory.getLogger( GatewaySampleFuncTest.class );
+  private static final Logger LOG = LogManager.getLogger( GatewaySampleFuncTest.class );
 
   public static GatewayConfig config;
   public static GatewayServer gateway;
diff --git a/gateway-test/src/test/java/org/apache/knox/gateway/GatewaySslFuncTest.java b/gateway-test/src/test/java/org/apache/knox/gateway/GatewaySslFuncTest.java
index edacab2..24d58b1 100644
--- a/gateway-test/src/test/java/org/apache/knox/gateway/GatewaySslFuncTest.java
+++ b/gateway-test/src/test/java/org/apache/knox/gateway/GatewaySslFuncTest.java
@@ -62,13 +62,13 @@ import org.apache.http.impl.client.BasicAuthCache;
 import org.apache.http.impl.client.BasicCredentialsProvider;
 import org.apache.http.impl.client.CloseableHttpClient;
 import org.apache.http.impl.client.HttpClients;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 import org.junit.After;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 import static org.apache.knox.test.TestUtils.LOG_ENTER;
 import static org.apache.knox.test.TestUtils.LOG_EXIT;
@@ -80,7 +80,7 @@ import static org.xmlmatchers.xpath.HasXPath.hasXPath;
 
 @Category( ReleaseTest.class )
 public class GatewaySslFuncTest {
-  private static final Logger LOG = LoggerFactory.getLogger( GatewaySslFuncTest.class );
+  private static final Logger LOG = LogManager.getLogger( GatewaySslFuncTest.class );
   private static final Class<?> DAT = GatewaySslFuncTest.class;
 
   private static GatewayTestConfig config;
diff --git a/gateway-test/src/test/java/org/apache/knox/gateway/Knox242FuncTest.java b/gateway-test/src/test/java/org/apache/knox/gateway/Knox242FuncTest.java
index 522703b..4b72582 100755
--- a/gateway-test/src/test/java/org/apache/knox/gateway/Knox242FuncTest.java
+++ b/gateway-test/src/test/java/org/apache/knox/gateway/Knox242FuncTest.java
@@ -53,7 +53,6 @@ public class Knox242FuncTest {
   @BeforeClass
   public static void setupSuite() throws Exception {
     LOG_ENTER();
-    //appenders = NoOpAppender.setUpAndReturnOriginalAppenders();
     String basedir = System.getProperty("basedir");
     if (basedir == null) {
       basedir = new File(".").getCanonicalPath();
diff --git a/gateway-test/src/test/java/org/apache/knox/gateway/KnoxCliLdapFuncTestNegative.java b/gateway-test/src/test/java/org/apache/knox/gateway/KnoxCliLdapFuncTestNegative.java
index d9ba639..06f1056 100644
--- a/gateway-test/src/test/java/org/apache/knox/gateway/KnoxCliLdapFuncTestNegative.java
+++ b/gateway-test/src/test/java/org/apache/knox/gateway/KnoxCliLdapFuncTestNegative.java
@@ -23,8 +23,6 @@ import org.apache.knox.gateway.services.DefaultGatewayServices;
 import org.apache.knox.gateway.services.ServiceLifecycleException;
 import org.apache.knox.gateway.util.KnoxCLI;
 import org.apache.knox.test.TestUtils;
-import org.apache.knox.test.log.NoOpAppender;
-import org.apache.log4j.Appender;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -35,7 +33,6 @@ import java.io.OutputStream;
 import java.io.PrintStream;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
-import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.UUID;
@@ -252,12 +249,7 @@ public class KnoxCliLdapFuncTestNegative {
 
     String[] args2 = {"user-auth-test", "--master", "knox", "--cluster", "bad-cluster",
         "--u", username, "--p", password, "--g" };
-    Enumeration<Appender> before = NoOpAppender.setUpAndReturnOriginalAppenders();
-    try {
-      cli.run( args2 );
-    } finally {
-      NoOpAppender.resetOriginalAppenders( before );
-    }
+    cli.run( args2 );
 
     assertThat(outContent.toString(StandardCharsets.UTF_8.name()), containsString("LDAP authentication failed"));
     assertThat(outContent.toString(StandardCharsets.UTF_8.name()), containsString("INVALID_CREDENTIALS"));
diff --git a/gateway-test/src/test/java/org/apache/knox/gateway/KnoxCliLdapFuncTestPositive.java b/gateway-test/src/test/java/org/apache/knox/gateway/KnoxCliLdapFuncTestPositive.java
index d0fe3c5..b630e15 100644
--- a/gateway-test/src/test/java/org/apache/knox/gateway/KnoxCliLdapFuncTestPositive.java
+++ b/gateway-test/src/test/java/org/apache/knox/gateway/KnoxCliLdapFuncTestPositive.java
@@ -6,9 +6,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -23,8 +23,6 @@ import org.apache.knox.gateway.services.DefaultGatewayServices;
 import org.apache.knox.gateway.services.ServiceLifecycleException;
 import org.apache.knox.gateway.util.KnoxCLI;
 import org.apache.knox.test.TestUtils;
-import org.apache.knox.test.log.NoOpAppender;
-import org.apache.log4j.Appender;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -35,7 +33,6 @@ import java.io.OutputStream;
 import java.io.PrintStream;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
-import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.UUID;
@@ -237,12 +234,7 @@ public class KnoxCliLdapFuncTestPositive {
     username = "bad-name";
     password = "bad-password";
     String[] args2 = {"user-auth-test", "--master", "knox", "--cluster", "test-cluster", "--u", username, "--p", password};
-    Enumeration<Appender> before = NoOpAppender.setUpAndReturnOriginalAppenders();
-    try {
-      cli.run( args2 );
-    } finally {
-      NoOpAppender.resetOriginalAppenders( before );
-    }
+    cli.run(args2);
     assertThat(outContent.toString(StandardCharsets.UTF_8.name()), containsString("LDAP authentication failed"));
 
 //    Test 3: Authenticate a user who belongs to no groups, but specify groups with --g
diff --git a/gateway-test/src/test/java/org/apache/knox/gateway/KnoxCliSysBindTest.java b/gateway-test/src/test/java/org/apache/knox/gateway/KnoxCliSysBindTest.java
index b5cf125..bd1c772 100644
--- a/gateway-test/src/test/java/org/apache/knox/gateway/KnoxCliSysBindTest.java
+++ b/gateway-test/src/test/java/org/apache/knox/gateway/KnoxCliSysBindTest.java
@@ -23,8 +23,6 @@ import org.apache.knox.gateway.services.DefaultGatewayServices;
 import org.apache.knox.gateway.services.ServiceLifecycleException;
 import org.apache.knox.gateway.util.KnoxCLI;
 import org.apache.knox.test.TestUtils;
-import org.apache.knox.test.log.NoOpAppender;
-import org.apache.log4j.Appender;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -35,7 +33,6 @@ import java.io.OutputStream;
 import java.io.PrintStream;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
-import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.UUID;
@@ -240,12 +237,7 @@ public class KnoxCliSysBindTest {
     String[] args3 = { "system-user-auth-test", "--master", "knox", "--cluster", "test-cluster-3", "--d" };
     cli = new KnoxCLI();
     cli.setConf(config);
-    Enumeration<Appender> before = NoOpAppender.setUpAndReturnOriginalAppenders();
-    try {
-      cli.run( args3 );
-    } finally {
-      NoOpAppender.resetOriginalAppenders( before );
-    }
+    cli.run( args3 );
     assertThat(outContent.toString(StandardCharsets.UTF_8.name()), containsString("LDAP authentication failed"));
     assertThat(outContent.toString(StandardCharsets.UTF_8.name()), containsString("Unable to successfully bind to LDAP server with topology credentials"));
 
diff --git a/gateway-test/src/test/java/org/apache/knox/gateway/deploy/DeploymentFactoryFuncTest.java b/gateway-test/src/test/java/org/apache/knox/gateway/deploy/DeploymentFactoryFuncTest.java
index 4982442..57c68eb 100644
--- a/gateway-test/src/test/java/org/apache/knox/gateway/deploy/DeploymentFactoryFuncTest.java
+++ b/gateway-test/src/test/java/org/apache/knox/gateway/deploy/DeploymentFactoryFuncTest.java
@@ -21,7 +21,6 @@ import java.io.File;
 import java.io.IOException;
 import java.net.URL;
 import java.util.Collections;
-import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.UUID;
@@ -44,8 +43,6 @@ import org.apache.knox.gateway.topology.Service;
 import org.apache.knox.gateway.topology.Topology;
 import org.apache.knox.gateway.util.XmlUtils;
 import org.apache.knox.test.TestUtils;
-import org.apache.knox.test.log.NoOpAppender;
-import org.apache.log4j.Appender;
 import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
 import org.jboss.shrinkwrap.api.spec.WebArchive;
 import org.junit.Test;
@@ -180,7 +177,6 @@ public class DeploymentFactoryFuncTest {
     provider.addParam( param );
     topology.addProvider( provider );
 
-    Enumeration<Appender> appenders = NoOpAppender.setUpAndReturnOriginalAppenders();
     try {
       DeploymentFactory.createDeployment( config, topology );
       fail( "Should have throws IllegalArgumentException" );
@@ -190,8 +186,6 @@ public class DeploymentFactoryFuncTest {
                        "Please check the topology for errors in name and role and that " +
                        "the provider is on the classpath.",
           e.getMessage());
-    } finally {
-      NoOpAppender.resetOriginalAppenders( appenders );
     }
     LOG_EXIT();
   }
diff --git a/gateway-test/src/test/resources/log4j.properties b/gateway-test/src/test/resources/log4j.properties
deleted file mode 100644
index e856ca7..0000000
--- a/gateway-test/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,44 +0,0 @@
-##########################################################################
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-##########################################################################
-
-#log4j.rootLogger=DEBUG, stdout
-log4j.rootLogger=ERROR, stdout
-
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%5p [%c] %m%n
-
-log4j.logger.audit = INFO, collectappender
-log4j.appender.collectappender = org.apache.knox.test.log.CollectAppender
-
-#log4j.logger.org.apache.knox.gateway=DEBUG
-#log4j.logger.org.apache.knox.test=DEBUG
-#log4j.logger.org.apache.knox.gateway.http=TRACE
-#log4j.logger.org.apache.knox.gateway.http.request.body=OFF
-#log4j.logger.org.apache.knox.gateway.http.response.body=OFF
-
-#log4j.logger.org.apache.directory=DEBUG
-#log4j.logger.org.eclipse.jetty=DEBUG
-#log4j.logger.org.apache.shiro=DEBUG
-#log4j.logger.org.apache.http=DEBUG
-#log4j.logger.org.apache.http.headers=DEBUG
-#log4j.logger.org.apache.http.wire=DEBUG
-#log4j.logger.org.apache.http.client=DEBUG
-
-# Hide verbose logging - see KNOX-1718 for more details
-log4j.logger.org.apache.directory.api.ldap.model.entry.Value=OFF
diff --git a/gateway-test/src/test/resources/log4j2.xml b/gateway-test/src/test/resources/log4j2.xml
new file mode 100644
index 0000000..d128ca2
--- /dev/null
+++ b/gateway-test/src/test/resources/log4j2.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<Configuration>
+    <Appenders>
+        <Console name="console" target="SYSTEM_OUT">
+            <PatternLayout pattern="[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n"/>
+        </Console>
+        <CollectAppender name="collectappender" />
+    </Appenders>
+    <Loggers>
+        <Logger name="org.apache.directory.api.ldap.model.entry.Value" level="OFF" />
+        <Root level="error">
+            <AppenderRef ref="console" />
+        </Root>
+        <Logger name="audit" level="info">
+            <AppenderRef ref="collectappender" />
+        </Logger>
+
+<!--        <Logger name="org.apache.directory" level="DEBUG" />-->
+<!--        <Logger name="org.apache.knox.gateway.http.request.body" level="OFF" />-->
+<!--        <Logger name="org.eclipse.jetty" level="DEBUG" />-->
+<!--        <Logger name="org.apache.knox.gateway.http.response.body" level="OFF" />-->
+<!--        <Logger name="org.apache.http.client" level="DEBUG" />-->
+<!--        <Logger name="org.apache.knox.gateway" level="DEBUG" />-->
+<!--        <Logger name="org.apache.knox.gateway.http" level="TRACE" />-->
+<!--        <Logger name="org.apache.http" level="DEBUG" />-->
+<!--        <Logger name="org.apache.knox.test" level="DEBUG" />-->
+<!--        <Logger name="org.apache.http.wire" level="DEBUG" />-->
+<!--        <Logger name="org.apache.shiro" level="DEBUG" />-->
+<!--        <Logger name="org.apache.http.headers" level="DEBUG" />-->
+
+    </Loggers>
+</Configuration>
\ No newline at end of file
diff --git a/gateway-util-common/pom.xml b/gateway-util-common/pom.xml
index 0226bb1..7766413 100644
--- a/gateway-util-common/pom.xml
+++ b/gateway-util-common/pom.xml
@@ -70,17 +70,16 @@
         </dependency>
 
         <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-api</artifactId>
+            <groupId>org.apache.logging.log4j</groupId>
+            <artifactId>log4j-api</artifactId>
         </dependency>
         <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-log4j12</artifactId>
+            <groupId>org.apache.logging.log4j</groupId>
+            <artifactId>log4j-core</artifactId>
         </dependency>
-        
         <dependency>
-            <groupId>log4j</groupId>
-            <artifactId>log4j</artifactId>
+            <groupId>org.apache.logging.log4j</groupId>
+            <artifactId>log4j-slf4j-impl</artifactId>
         </dependency>
 
         <!-- ********** ********** ********** ********** ********** ********** -->
diff --git a/gateway-util-common/src/main/java/org/apache/knox/gateway/audit/api/CorrelationContext.java b/gateway-util-common/src/main/java/org/apache/knox/gateway/audit/api/CorrelationContext.java
index 40f3a2b..3f24768 100644
--- a/gateway-util-common/src/main/java/org/apache/knox/gateway/audit/api/CorrelationContext.java
+++ b/gateway-util-common/src/main/java/org/apache/knox/gateway/audit/api/CorrelationContext.java
@@ -29,16 +29,6 @@ public interface CorrelationContext extends Serializable {
   String getRequestId();
 
   /**
-   * A unique value representing the current, active request.
-   * If the current request id value is different from the current parent request id value then
-   * the current request id value is moved to the parent request id before it is replaced by the provided request id.
-   * If the root request id is not set it will be set with the first non-null value of either the parent request id or the passed request id.
-   *
-   * @param requestId A unique value representing the current, active request.
-   */
-  void setRequestId( String requestId );
-
-  /**
    * The parent request ID if this is a sub-request.
    *
    * @return The parent request ID.
@@ -46,31 +36,10 @@ public interface CorrelationContext extends Serializable {
   String getParentRequestId();
 
   /**
-   * Sets the parent request ID if this is a sub-request.
-   *
-   * @param parentRequestId The parent request ID.
-   */
-  void setParentRequestId( String parentRequestId );
-
-  /**
    * The root request ID if this is a sub-request.
    *
    * @return The root request ID.
    */
   String getRootRequestId();
 
-  /**
-   * Sets the root request ID if this is a sub-request.
-   *
-   * @param rootRequestId The root request ID.
-   */
-  void setRootRequestId( String rootRequestId );
-
-  /**
-   * Would be used to indicate that the context can be cleaned and reused.
-   * This is only important if the service would like to maintain a pool of available "empty" context
-   * that can be reused to limit memory allocation and garbage collection.
-   */
-  void destroy();
-
 }
diff --git a/gateway-util-common/src/main/java/org/apache/knox/gateway/audit/api/CorrelationService.java b/gateway-util-common/src/main/java/org/apache/knox/gateway/audit/api/CorrelationService.java
index fb7b2ac..d2885b6 100644
--- a/gateway-util-common/src/main/java/org/apache/knox/gateway/audit/api/CorrelationService.java
+++ b/gateway-util-common/src/main/java/org/apache/knox/gateway/audit/api/CorrelationService.java
@@ -23,19 +23,6 @@ import java.util.concurrent.Callable;
  * Manipulates the correlations context associated with the current thread.
  */
 public interface CorrelationService {
-
-  /**
-   * The recommended protocol header name used to transmit the correlation context over the network.
-   */
-  String PROTOCOL_HEADER = "X-Correlation-Context";
-
-  /**
-   * Creates a new correlation context.  The context is attached and empty.
-   *
-   * @return A new correlation context.
-   */
-  CorrelationContext createContext();
-
   /**
    * Returns the current attached correlation context if any.
    *
@@ -55,10 +42,8 @@ public interface CorrelationService {
   /**
    * Detaches the existing attached context if any.
    * This will typically be done so that the context can be persisted or attached to a different thread.
-   *
-   * @return The now detached correlation context.  May be null.
    */
-  CorrelationContext detachContext();
+  void detachContext();
 
   /**
    * Executes the callable within the provided correlation context.
diff --git a/gateway-util-common/src/main/java/org/apache/knox/gateway/audit/log4j/appender/JdbmStoreAndForwardAppender.java b/gateway-util-common/src/main/java/org/apache/knox/gateway/audit/log4j/appender/JdbmStoreAndForwardAppender.java
index 865b34e..688470e 100644
--- a/gateway-util-common/src/main/java/org/apache/knox/gateway/audit/log4j/appender/JdbmStoreAndForwardAppender.java
+++ b/gateway-util-common/src/main/java/org/apache/knox/gateway/audit/log4j/appender/JdbmStoreAndForwardAppender.java
@@ -21,55 +21,52 @@ import java.io.File;
 import java.io.IOException;
 import java.util.concurrent.atomic.AtomicBoolean;
 
-import org.apache.log4j.AppenderSkeleton;
-import org.apache.log4j.Logger;
-import org.apache.log4j.spi.LoggingEvent;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.core.Appender;
+import org.apache.logging.log4j.core.Core;
+import org.apache.logging.log4j.core.Filter;
+import org.apache.logging.log4j.core.LogEvent;
+import org.apache.logging.log4j.core.Logger;
+import org.apache.logging.log4j.core.appender.AbstractAppender;
+import org.apache.logging.log4j.core.config.plugins.Plugin;
+import org.apache.logging.log4j.core.config.plugins.PluginAttribute;
+import org.apache.logging.log4j.core.config.plugins.PluginElement;
+import org.apache.logging.log4j.core.config.plugins.PluginFactory;
 
-public class JdbmStoreAndForwardAppender extends AppenderSkeleton {
-
-  private File file;
+@Plugin(
+    name = "JdbmStoreAndForwardAppender",
+    category = Core.CATEGORY_NAME,
+    elementType = Appender.ELEMENT_TYPE)
+public class JdbmStoreAndForwardAppender extends AbstractAppender {
   private Thread forwarder; //NOPMD - Expected use of threading
-  private JdbmQueue<LoggingEvent> queue;
+  private JdbmQueue<LogEvent> queue;
   private Logger forward;
-  private boolean fetchLocationInfo = true;
-
-  @Override
-  public boolean requiresLayout() {
-    return false;
-  }
-
-  public void setFile( String file ) {
-    this.file = new File( file );
-  }
-
-  public void setFetchLocationInfo( boolean fetchLocationInfo ) {
-    this.fetchLocationInfo = fetchLocationInfo;
-  }
-
-  public boolean isFetchLocationInfo() {
-    return fetchLocationInfo;
-  }
 
-  @Override
-  public void activateOptions() {
+  private JdbmStoreAndForwardAppender(String name, Filter filter, String file) {
+    super(name, filter, null);
     try {
-      queue = new JdbmQueue<>( file );
+      queue = new JdbmQueue<>(new File(file));
     } catch ( IOException e ) {
       throw new IllegalStateException( e );
     }
-    forward = Logger.getLogger( "audit.forward" );
-    forward.setAdditivity( false );
+    forward = (Logger)LogManager.getLogger( "audit.forward" );
+    forward.setAdditive( false );
     forwarder = new Forwarder();
     forwarder.setDaemon( true );
     forwarder.start();
   }
 
+  @PluginFactory
+  public static JdbmStoreAndForwardAppender createAppender(
+      @PluginAttribute("name") String name,
+      @PluginElement("Filter") Filter filter,
+      @PluginAttribute("file") String file) {
+    return new JdbmStoreAndForwardAppender(name, filter, file);
+  }
+
   @Override
-  protected void append( LoggingEvent event ) {
+  public void append( LogEvent event ) {
     try {
-      if( fetchLocationInfo ) {
-        event.getLocationInformation();
-      }
       queue.enqueue( event );
     } catch ( IOException e ) {
       throw new RuntimeException( e );
@@ -77,7 +74,7 @@ public class JdbmStoreAndForwardAppender extends AppenderSkeleton {
   }
 
   @Override
-  public void close() {
+  public void stop() {
     try {
       queue.stop();
       forwarder.join();
@@ -88,6 +85,7 @@ public class JdbmStoreAndForwardAppender extends AppenderSkeleton {
     } catch(IOException e) {
       throw new RuntimeException(e);
     }
+    super.stop();
   }
 
   @SuppressWarnings("PMD.DoNotUseThreads")
@@ -97,22 +95,21 @@ public class JdbmStoreAndForwardAppender extends AppenderSkeleton {
       final AtomicBoolean done = new AtomicBoolean( false );
       while( !done.get() ) {
         try {
-          queue.process( new JdbmQueue.Consumer<LoggingEvent>() {
-            @Override
-            public boolean consume( LoggingEvent event ) {
-              try {
-                if( event == null ) {
-                  done.set( true );
-                } else {
-                  forward.callAppenders( event );
+          queue.process(event -> {
+            try {
+              if( event == null ) {
+                done.set( true );
+              } else {
+                for(Appender appender : forward.getAppenders().values()) {
+                  appender.append(event);
                 }
-                return true;
-              } catch ( Exception e ) {
-                e.printStackTrace();
-                return false;
               }
+              return true;
+            } catch ( Exception e ) {
+              e.printStackTrace();
+              return false;
             }
-          } );
+          });
         } catch ( ThreadDeath e ) {
           throw e;
         } catch ( Throwable t ) {
diff --git a/gateway-util-common/src/main/java/org/apache/knox/gateway/audit/log4j/audit/Log4jAuditContext.java b/gateway-util-common/src/main/java/org/apache/knox/gateway/audit/log4j/audit/Log4jAuditContext.java
index 825a59b..bdedbc5 100644
--- a/gateway-util-common/src/main/java/org/apache/knox/gateway/audit/log4j/audit/Log4jAuditContext.java
+++ b/gateway-util-common/src/main/java/org/apache/knox/gateway/audit/log4j/audit/Log4jAuditContext.java
@@ -17,14 +17,14 @@
  */
 package org.apache.knox.gateway.audit.log4j.audit;
 
-import java.io.Serializable;
+import static org.apache.knox.gateway.audit.log4j.audit.Log4jAuditService.MDC_AUDIT_CONTEXT_KEY;
 
-import org.apache.knox.gateway.audit.api.AuditContext;
-
-public class Log4jAuditContext implements Serializable, AuditContext {
+import java.util.Map;
 
-  private static final long serialVersionUID = 1L;
+import org.apache.knox.gateway.audit.api.AuditContext;
+import org.apache.logging.log4j.core.LogEvent;
 
+public class Log4jAuditContext implements AuditContext {
   private String username;
   private String proxyUsername;
   private String systemUsername;
@@ -32,6 +32,33 @@ public class Log4jAuditContext implements Serializable, AuditContext {
   private String remoteIp;
   private String remoteHostname;
 
+  public static Log4jAuditContext of(LogEvent event) {
+    if (event == null) {
+      return null;
+    }
+    Map<String, String> data = event.getContextData().toMap();
+    return new Log4jAuditContext(
+            data.get(MDC_AUDIT_CONTEXT_KEY + "_username"),
+            data.get(MDC_AUDIT_CONTEXT_KEY + "_proxyUsername"),
+            data.get(MDC_AUDIT_CONTEXT_KEY + "_systemUsername"),
+            data.get(MDC_AUDIT_CONTEXT_KEY + "_targetServiceName"),
+            data.get(MDC_AUDIT_CONTEXT_KEY + "_remoteIp"),
+            data.get(MDC_AUDIT_CONTEXT_KEY + "_remoteHostname"));
+  }
+
+  public Log4jAuditContext() {
+  }
+
+  public Log4jAuditContext(String username, String proxyUsername, String systemUsername,
+                           String targetServiceName, String remoteIp, String remoteHostname) {
+    this.username = username;
+    this.proxyUsername = proxyUsername;
+    this.systemUsername = systemUsername;
+    this.targetServiceName = targetServiceName;
+    this.remoteIp = remoteIp;
+    this.remoteHostname = remoteHostname;
+  }
+
   @Override
   public String getUsername() {
     return username;
diff --git a/gateway-util-common/src/main/java/org/apache/knox/gateway/audit/log4j/audit/Log4jAuditService.java b/gateway-util-common/src/main/java/org/apache/knox/gateway/audit/log4j/audit/Log4jAuditService.java
index 988c677..65f4d7b 100644
--- a/gateway-util-common/src/main/java/org/apache/knox/gateway/audit/log4j/audit/Log4jAuditService.java
+++ b/gateway-util-common/src/main/java/org/apache/knox/gateway/audit/log4j/audit/Log4jAuditService.java
@@ -6,9 +6,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -24,7 +24,7 @@ import java.util.concurrent.ConcurrentHashMap;
 import org.apache.knox.gateway.audit.api.AuditContext;
 import org.apache.knox.gateway.audit.api.AuditService;
 import org.apache.knox.gateway.audit.api.Auditor;
-import org.apache.log4j.MDC;
+import org.apache.logging.log4j.ThreadContext;
 
 public class Log4jAuditService implements AuditService {
 
@@ -33,37 +33,56 @@ public class Log4jAuditService implements AuditService {
 
   @Override
   public AuditContext createContext() {
-    AuditContext context = getContext();
-    if ( context == null ) {
-      context = new Log4jAuditContext();
-      attachContext( context );
-    }
+    AuditContext context = new Log4jAuditContext();
+    attachContext(context);
     return context;
   }
 
   @Override
   public AuditContext getContext() {
-    return (Log4jAuditContext) MDC.get( MDC_AUDIT_CONTEXT_KEY );
+    if (ThreadContext.get(MDC_AUDIT_CONTEXT_KEY) == null) {
+      return null;
+    }
+    return new Log4jAuditContext(
+        ThreadContext.get(MDC_AUDIT_CONTEXT_KEY + "_username"),
+        ThreadContext.get(MDC_AUDIT_CONTEXT_KEY + "_proxyUsername"),
+        ThreadContext.get(MDC_AUDIT_CONTEXT_KEY + "_systemUsername"),
+        ThreadContext.get(MDC_AUDIT_CONTEXT_KEY + "_targetServiceName"),
+        ThreadContext.get(MDC_AUDIT_CONTEXT_KEY + "_remoteIp"),
+        ThreadContext.get(MDC_AUDIT_CONTEXT_KEY + "_remoteHostname")
+    );
   }
 
   @Override
   public void attachContext(AuditContext context) {
-    if ( context != null ) {
-      MDC.put( MDC_AUDIT_CONTEXT_KEY, context );
+    if (context != null) {
+      ThreadContext.put(MDC_AUDIT_CONTEXT_KEY, "true");
+      ThreadContext.put(MDC_AUDIT_CONTEXT_KEY + "_username", context.getUsername());
+      ThreadContext.put(MDC_AUDIT_CONTEXT_KEY + "_proxyUsername", context.getProxyUsername());
+      ThreadContext.put(MDC_AUDIT_CONTEXT_KEY + "_systemUsername", context.getSystemUsername());
+      ThreadContext.put(MDC_AUDIT_CONTEXT_KEY + "_targetServiceName", context.getTargetServiceName());
+      ThreadContext.put(MDC_AUDIT_CONTEXT_KEY + "_remoteIp", context.getRemoteIp());
+      ThreadContext.put(MDC_AUDIT_CONTEXT_KEY + "_remoteHostname", context.getRemoteHostname());
     }
   }
 
   @Override
   public AuditContext detachContext() {
-    AuditContext context = (AuditContext) MDC.get( MDC_AUDIT_CONTEXT_KEY );
-    MDC.remove( MDC_AUDIT_CONTEXT_KEY );
+    AuditContext context = getContext();
+    ThreadContext.remove(MDC_AUDIT_CONTEXT_KEY);
+    ThreadContext.remove(MDC_AUDIT_CONTEXT_KEY + "_username");
+    ThreadContext.remove(MDC_AUDIT_CONTEXT_KEY + "_proxyUsername");
+    ThreadContext.remove(MDC_AUDIT_CONTEXT_KEY + "_systemUsername");
+    ThreadContext.remove(MDC_AUDIT_CONTEXT_KEY + "_targetServiceName");
+    ThreadContext.remove(MDC_AUDIT_CONTEXT_KEY + "_remoteIp");
+    ThreadContext.remove(MDC_AUDIT_CONTEXT_KEY + "_remoteHostname");
     return context;
   }
 
   @Override
-  public <T> T execute( AuditContext context, Callable<T> callable ) throws Exception {
+  public <T> T execute(AuditContext context, Callable<T> callable) throws Exception {
     try {
-      attachContext( context );
+      attachContext(context);
       return callable.call();
     } finally {
       detachContext();
@@ -71,12 +90,12 @@ public class Log4jAuditService implements AuditService {
   }
 
   @Override
-  public synchronized Auditor getAuditor( String auditorName, String componentName, String serviceName ) {
+  public synchronized Auditor getAuditor(String auditorName, String componentName, String serviceName) {
     String key = auditorName + componentName + serviceName;
-    Auditor auditor = auditors.get( key );
-    if( auditor == null ) {
-      auditor = new Log4jAuditor( auditorName, componentName, serviceName );
-      auditors.put( key, auditor );
+    Auditor auditor = auditors.get(key);
+    if (auditor == null) {
+      auditor = new Log4jAuditor(auditorName, componentName, serviceName);
+      auditors.put(key, auditor);
     }
     return auditor;
   }
diff --git a/gateway-util-common/src/main/java/org/apache/knox/gateway/audit/log4j/audit/Log4jAuditor.java b/gateway-util-common/src/main/java/org/apache/knox/gateway/audit/log4j/audit/Log4jAuditor.java
index 3050871..48e7e8f 100644
--- a/gateway-util-common/src/main/java/org/apache/knox/gateway/audit/log4j/audit/Log4jAuditor.java
+++ b/gateway-util-common/src/main/java/org/apache/knox/gateway/audit/log4j/audit/Log4jAuditor.java
@@ -17,16 +17,15 @@
  */
 package org.apache.knox.gateway.audit.log4j.audit;
 
-
-
 import org.apache.knox.gateway.audit.api.AuditContext;
 import org.apache.knox.gateway.audit.api.AuditService;
 import org.apache.knox.gateway.audit.api.Auditor;
 import org.apache.knox.gateway.audit.api.CorrelationContext;
 import org.apache.knox.gateway.audit.api.CorrelationService;
 import org.apache.knox.gateway.audit.log4j.correlation.Log4jCorrelationService;
-import org.apache.log4j.Logger;
-import org.apache.log4j.MDC;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.ThreadContext;
+import org.apache.logging.log4j.core.Logger;
 
 import java.net.URI;
 import java.util.ArrayList;
@@ -52,8 +51,8 @@ public class Log4jAuditor implements Auditor {
   }
 
   public Log4jAuditor( String loggerName, String componentName, String serviceName ) {
-    logger = Logger.getLogger( loggerName );
-    logger.setAdditivity( false );
+    logger = (Logger) LogManager.getLogger( loggerName );
+    logger.setAdditive(false);
     this.componentName = componentName;
     this.serviceName = serviceName;
 
@@ -102,21 +101,21 @@ public class Log4jAuditor implements Auditor {
 
   private void auditLog( String action, String resourceName, String resourceType, String outcome, String message ) {
     if ( logger.isInfoEnabled() ) {
-      MDC.put( AuditConstants.MDC_ACTION_KEY, action );
-      MDC.put( AuditConstants.MDC_RESOURCE_NAME_KEY, maskTokenFromURL(resourceName) );
-      MDC.put( AuditConstants.MDC_RESOURCE_TYPE_KEY, resourceType );
-      MDC.put( AuditConstants.MDC_OUTCOME_KEY, outcome );
-      MDC.put( AuditConstants.MDC_SERVICE_KEY, serviceName );
-      MDC.put( AuditConstants.MDC_COMPONENT_KEY, componentName );
+      ThreadContext.put( AuditConstants.MDC_ACTION_KEY, action );
+      ThreadContext.put( AuditConstants.MDC_RESOURCE_NAME_KEY, maskTokenFromURL(resourceName) );
+      ThreadContext.put( AuditConstants.MDC_RESOURCE_TYPE_KEY, resourceType );
+      ThreadContext.put( AuditConstants.MDC_OUTCOME_KEY, outcome );
+      ThreadContext.put( AuditConstants.MDC_SERVICE_KEY, serviceName );
+      ThreadContext.put( AuditConstants.MDC_COMPONENT_KEY, componentName );
 
       logger.info( message );
 
-      MDC.remove( AuditConstants.MDC_ACTION_KEY );
-      MDC.remove( AuditConstants.MDC_RESOURCE_NAME_KEY );
-      MDC.remove( AuditConstants.MDC_RESOURCE_TYPE_KEY );
-      MDC.remove( AuditConstants.MDC_OUTCOME_KEY );
-      MDC.remove( AuditConstants.MDC_SERVICE_KEY );
-      MDC.remove( AuditConstants.MDC_COMPONENT_KEY );
+      ThreadContext.remove( AuditConstants.MDC_ACTION_KEY );
+      ThreadContext.remove( AuditConstants.MDC_RESOURCE_NAME_KEY );
+      ThreadContext.remove( AuditConstants.MDC_RESOURCE_TYPE_KEY );
+      ThreadContext.remove( AuditConstants.MDC_OUTCOME_KEY );
+      ThreadContext.remove( AuditConstants.MDC_SERVICE_KEY );
+      ThreadContext.remove( AuditConstants.MDC_COMPONENT_KEY );
     }
   }
 
diff --git a/gateway-util-common/src/main/java/org/apache/knox/gateway/audit/log4j/correlation/Log4jCorrelationContext.java b/gateway-util-common/src/main/java/org/apache/knox/gateway/audit/log4j/correlation/Log4jCorrelationContext.java
index 615ff34..1a3cacd 100644
--- a/gateway-util-common/src/main/java/org/apache/knox/gateway/audit/log4j/correlation/Log4jCorrelationContext.java
+++ b/gateway-util-common/src/main/java/org/apache/knox/gateway/audit/log4j/correlation/Log4jCorrelationContext.java
@@ -17,21 +17,34 @@
  */
 package org.apache.knox.gateway.audit.log4j.correlation;
 
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
+import static org.apache.knox.gateway.audit.log4j.correlation.Log4jCorrelationService.KEY_PARENT_REQUEST_ID;
+import static org.apache.knox.gateway.audit.log4j.correlation.Log4jCorrelationService.KEY_REQUEST_ID;
+import static org.apache.knox.gateway.audit.log4j.correlation.Log4jCorrelationService.KEY_ROOT_REQUEST_ID;
 
-import org.apache.knox.gateway.audit.api.CorrelationContext;
-
-public class Log4jCorrelationContext implements Externalizable, CorrelationContext {
+import java.util.Map;
+import java.util.UUID;
 
-  private byte versionUID = 1;
-  private String requestId;
-  private String parentRequestId;
-  private String rootRequestId;
+import org.apache.knox.gateway.audit.api.CorrelationContext;
+import org.apache.logging.log4j.core.LogEvent;
+
+public class Log4jCorrelationContext implements CorrelationContext {
+  private final String requestId;
+  private final String parentRequestId;
+  private final String rootRequestId;
+
+  public static Log4jCorrelationContext of(LogEvent event) {
+    if (event == null) {
+      return null;
+    }
+    Map<String, String> data = event.getContextData().toMap();
+    return data.containsKey(KEY_REQUEST_ID)
+        ? new Log4jCorrelationContext(data.get(KEY_REQUEST_ID), data.get(KEY_PARENT_REQUEST_ID), data.get(KEY_ROOT_REQUEST_ID))
+        : null;
+  }
 
-  public Log4jCorrelationContext() {
+  public static Log4jCorrelationContext random() {
+    return new Log4jCorrelationContext(
+            UUID.randomUUID().toString(), UUID.randomUUID().toString(), UUID.randomUUID().toString());
   }
 
   public Log4jCorrelationContext( String requestId, String parentRequestId,
@@ -47,31 +60,16 @@ public class Log4jCorrelationContext implements Externalizable, CorrelationConte
   }
 
   @Override
-  public void setRequestId( String requestId ) {
-    this.requestId = requestId;
-  }
-
-  @Override
   public String getParentRequestId() {
     return parentRequestId;
   }
 
   @Override
-  public void setParentRequestId( String parentRequestId ) {
-    this.parentRequestId = parentRequestId;
-  }
-
-  @Override
   public String getRootRequestId() {
     return rootRequestId;
   }
 
   @Override
-  public void setRootRequestId( String rootRequestId ) {
-    this.rootRequestId = rootRequestId;
-  }
-
-  @Override
   public String toString() {
     return "[" +
                "request_id=" + requestId +
@@ -79,25 +77,4 @@ public class Log4jCorrelationContext implements Externalizable, CorrelationConte
                ", root_request_id=" + rootRequestId +
                "]";
   }
-
-  @Override
-  public void writeExternal(ObjectOutput out) throws IOException {
-    out.writeByte( versionUID );
-    out.writeObject( requestId );
-    out.writeObject( parentRequestId );
-    out.writeObject( rootRequestId );
-  }
-
-  @Override
-  public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-    versionUID = in.readByte();
-    requestId = (String)in.readObject();
-    parentRequestId = (String)in.readObject();
-    rootRequestId = (String)in.readObject();
-  }
-
-  @Override
-  public void destroy() {
-  }
-
 }
diff --git a/gateway-util-common/src/main/java/org/apache/knox/gateway/audit/log4j/correlation/Log4jCorrelationService.java b/gateway-util-common/src/main/java/org/apache/knox/gateway/audit/log4j/correlation/Log4jCorrelationService.java
index 8c7def4..a050c60 100644
--- a/gateway-util-common/src/main/java/org/apache/knox/gateway/audit/log4j/correlation/Log4jCorrelationService.java
+++ b/gateway-util-common/src/main/java/org/apache/knox/gateway/audit/log4j/correlation/Log4jCorrelationService.java
@@ -6,9 +6,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -27,45 +27,45 @@ import java.util.concurrent.Callable;
 
 import org.apache.knox.gateway.audit.api.CorrelationContext;
 import org.apache.knox.gateway.audit.api.CorrelationService;
-import org.apache.log4j.MDC;
+import org.apache.logging.log4j.ThreadContext;
 
 public class Log4jCorrelationService implements CorrelationService {
-
-  public static final String MDC_CORRELATION_CONTEXT_KEY = "correlation_context";
-
-  @Override
-  public CorrelationContext createContext() {
-    CorrelationContext context = getContext();
-    if ( context == null ) {
-      context = new Log4jCorrelationContext();
-      attachContext( context );
-    }
-    return context;
-  }
+  public static final String KEY_CORRELATION_CONTEXT = "correlation_context";
+  public static final String KEY_ROOT_REQUEST_ID = KEY_CORRELATION_CONTEXT + "_rootRequestId";
+  public static final String KEY_PARENT_REQUEST_ID = KEY_CORRELATION_CONTEXT + "_parentRequestId";
+  public static final String KEY_REQUEST_ID = KEY_CORRELATION_CONTEXT + "_requestId";
 
   @Override
   public CorrelationContext getContext() {
-    return (CorrelationContext) MDC.get( MDC_CORRELATION_CONTEXT_KEY );
+    if (ThreadContext.get(KEY_CORRELATION_CONTEXT) == null) {
+      return null;
+    }
+    return new Log4jCorrelationContext(
+              ThreadContext.get(KEY_REQUEST_ID), ThreadContext.get(KEY_PARENT_REQUEST_ID), ThreadContext.get(KEY_ROOT_REQUEST_ID));
   }
 
   @Override
-  public void attachContext( CorrelationContext context ) {
-    if ( context != null ) {
-      MDC.put( MDC_CORRELATION_CONTEXT_KEY, context );
+  public void attachContext(CorrelationContext context) {
+    if (context != null) {
+      ThreadContext.put(KEY_CORRELATION_CONTEXT, "true");
+      ThreadContext.put(KEY_REQUEST_ID, context.getRequestId());
+      ThreadContext.put(KEY_PARENT_REQUEST_ID, context.getParentRequestId());
+      ThreadContext.put(KEY_ROOT_REQUEST_ID, context.getRootRequestId());
     }
   }
 
   @Override
-  public CorrelationContext detachContext() {
-    CorrelationContext context = (CorrelationContext) MDC.get( MDC_CORRELATION_CONTEXT_KEY );
-    MDC.remove( MDC_CORRELATION_CONTEXT_KEY );
-    return context;
+  public void detachContext() {
+    ThreadContext.remove(KEY_CORRELATION_CONTEXT);
+    ThreadContext.remove(KEY_REQUEST_ID);
+    ThreadContext.remove(KEY_PARENT_REQUEST_ID);
+    ThreadContext.remove(KEY_ROOT_REQUEST_ID);
   }
 
   @Override
-  public <T> T execute( CorrelationContext context, Callable<T> callable ) throws Exception {
+  public <T> T execute(CorrelationContext context, Callable<T> callable) throws Exception {
     try {
-      attachContext( context );
+      attachContext(context);
       return callable.call();
     } finally {
       detachContext();
@@ -74,8 +74,8 @@ public class Log4jCorrelationService implements CorrelationService {
 
   @Override
   public CorrelationContext attachExternalizedContext(byte[] externalizedContext) {
-    CorrelationContext context = readExternalizedContext( externalizedContext );
-    attachContext( context );
+    CorrelationContext context = readExternalizedContext(externalizedContext);
+    attachContext(context);
     return context;
   }
 
@@ -100,7 +100,7 @@ public class Log4jCorrelationService implements CorrelationService {
   public byte[] getExternalizedContext() {
     try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
       try(ObjectOutputStream oos = new ObjectOutputStream( baos )) {
-        oos.writeObject( getContext() );
+        oos.writeObject(getContext());
       }
       return baos.toByteArray();
     } catch ( IOException e ) {
diff --git a/gateway-util-common/src/main/java/org/apache/knox/gateway/audit/log4j/layout/AuditLayout.java b/gateway-util-common/src/main/java/org/apache/knox/gateway/audit/log4j/layout/AuditLayout.java
index 7a2d817..62f47f0 100644
--- a/gateway-util-common/src/main/java/org/apache/knox/gateway/audit/log4j/layout/AuditLayout.java
+++ b/gateway-util-common/src/main/java/org/apache/knox/gateway/audit/log4j/layout/AuditLayout.java
@@ -17,63 +17,83 @@
  */
 package org.apache.knox.gateway.audit.log4j.layout;
 
+import java.nio.charset.Charset;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Locale;
+import java.util.TimeZone;
+
 import org.apache.knox.gateway.audit.api.AuditContext;
 import org.apache.knox.gateway.audit.api.CorrelationContext;
 import org.apache.knox.gateway.audit.log4j.audit.AuditConstants;
-import org.apache.knox.gateway.audit.log4j.audit.Log4jAuditService;
-import org.apache.knox.gateway.audit.log4j.correlation.Log4jCorrelationService;
-import org.apache.log4j.helpers.DateLayout;
-import org.apache.log4j.spi.LoggingEvent;
+import org.apache.knox.gateway.audit.log4j.audit.Log4jAuditContext;
+import org.apache.knox.gateway.audit.log4j.correlation.Log4jCorrelationContext;
+import org.apache.logging.log4j.core.Core;
+import org.apache.logging.log4j.core.Layout;
+import org.apache.logging.log4j.core.LogEvent;
+import org.apache.logging.log4j.core.config.plugins.Plugin;
+import org.apache.logging.log4j.core.config.plugins.PluginAttribute;
+import org.apache.logging.log4j.core.config.plugins.PluginFactory;
+import org.apache.logging.log4j.core.layout.AbstractStringLayout;
+import org.apache.logging.log4j.util.ReadOnlyStringMap;
+import org.apache.logging.log4j.util.Strings;
 
 /**
  * Formats audit record to following output:
  * date time root_request_id|parent_request_id|request_id|channel|target_service|username|proxy_username|system_username|action|resource_type|resource_name|outcome|message
  */
-public class AuditLayout extends DateLayout {
+@Plugin(name = "AuditLayout", category = Core.CATEGORY_NAME, elementType = Layout.ELEMENT_TYPE, printObject = true)
+public class AuditLayout extends AbstractStringLayout {
+  private static final String DATE_PATTERN = "yy/MM/dd HH:mm:ss ";
+  private final DateFormat dateFormat;
+  private static final Character SEPARATOR = '|';
+  private final StringBuffer sb = new StringBuffer();
 
-  private static final String DATE_FORMAT = "yy/MM/dd HH:mm:ss";
-  private static final String SEPARATOR = "|";
-  private StringBuffer sb = new StringBuffer();
+  @PluginFactory
+  public static AuditLayout createLayout(@PluginAttribute(value = "charset", defaultString = "UTF-8") Charset charset) {
+    return new AuditLayout(charset);
+  }
 
-  @Override
-  public void activateOptions() {
-    setDateFormat( DATE_FORMAT );
+  public AuditLayout(Charset charset) {
+    super(charset);
+    dateFormat = dateFormat();
+  }
+
+  private SimpleDateFormat dateFormat() {
+    SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DATE_PATTERN, Locale.getDefault(Locale.Category.FORMAT));
+    simpleDateFormat.setTimeZone(TimeZone.getDefault());
+    return simpleDateFormat;
   }
 
   @Override
-  public String format( LoggingEvent event ) {
+  public String toSerializable(LogEvent event) {
     sb.setLength( 0 );
-    dateFormat( sb, event );
-    CorrelationContext cc = (CorrelationContext)event.getMDC( Log4jCorrelationService.MDC_CORRELATION_CONTEXT_KEY );
-    AuditContext ac = (AuditContext)event.getMDC( Log4jAuditService.MDC_AUDIT_CONTEXT_KEY );
+    sb.append(dateFormat.format(event.getTimeMillis()));
+    CorrelationContext cc = Log4jCorrelationContext.of(event);
     appendParameter( cc == null ? null : cc.getRootRequestId() );
     appendParameter( cc == null ? null : cc.getParentRequestId() );
     appendParameter( cc == null ? null : cc.getRequestId() );
     appendParameter( event.getLoggerName() );
+    AuditContext ac = Log4jAuditContext.of(event);
     appendParameter( ac == null ? null : ac.getRemoteIp() );
     appendParameter( ac == null ? null : ac.getTargetServiceName() );
     appendParameter( ac == null ? null : ac.getUsername() );
     appendParameter( ac == null ? null : ac.getProxyUsername() );
     appendParameter( ac == null ? null : ac.getSystemUsername() );
-    appendParameter( (String)event.getMDC( AuditConstants.MDC_ACTION_KEY ) );
-    appendParameter( (String)event.getMDC( AuditConstants.MDC_RESOURCE_TYPE_KEY ) );
-    appendParameter( (String)event.getMDC( AuditConstants.MDC_RESOURCE_NAME_KEY ) );
-    appendParameter( (String)event.getMDC( AuditConstants.MDC_OUTCOME_KEY ) );
-    String message = event.getRenderedMessage();
-    sb.append( message == null ? "" : message ).append( LINE_SEP );
+    ReadOnlyStringMap eventContextData = event.getContextData();
+    appendParameter( eventContextData.getValue( AuditConstants.MDC_ACTION_KEY ) );
+    appendParameter( eventContextData.getValue( AuditConstants.MDC_RESOURCE_TYPE_KEY ) );
+    appendParameter( eventContextData.getValue( AuditConstants.MDC_RESOURCE_NAME_KEY ) );
+    appendParameter( eventContextData.getValue( AuditConstants.MDC_OUTCOME_KEY ) );
+    String message = event.getMessage() == null ? null : event.getMessage().getFormattedMessage();
+    sb.append(message == null || "null".equals(message) ? Strings.EMPTY : message).append( System.lineSeparator());
     return sb.toString();
   }
 
-  @Override
-  public boolean ignoresThrowable() {
-    return true;
-  }
-
   private void appendParameter( String parameter ) {
     if ( parameter != null ) {
       sb.append( parameter );
     }
     sb.append( SEPARATOR );
   }
-
 }
diff --git a/gateway-util-common/src/test/java/org/apache/knox/gateway/audit/AuditLayoutTest.java b/gateway-util-common/src/test/java/org/apache/knox/gateway/audit/AuditLayoutTest.java
index 57726f4..1d60bfc 100644
--- a/gateway-util-common/src/test/java/org/apache/knox/gateway/audit/AuditLayoutTest.java
+++ b/gateway-util-common/src/test/java/org/apache/knox/gateway/audit/AuditLayoutTest.java
@@ -17,6 +17,14 @@
  */
 package org.apache.knox.gateway.audit;
 
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+import java.io.File;
+import java.nio.charset.StandardCharsets;
+import java.text.SimpleDateFormat;
+import java.util.Locale;
+
 import org.apache.knox.gateway.audit.api.AuditContext;
 import org.apache.knox.gateway.audit.api.AuditService;
 import org.apache.knox.gateway.audit.api.AuditServiceFactory;
@@ -25,29 +33,20 @@ import org.apache.knox.gateway.audit.api.CorrelationContext;
 import org.apache.knox.gateway.audit.api.CorrelationService;
 import org.apache.knox.gateway.audit.api.CorrelationServiceFactory;
 import org.apache.knox.gateway.audit.log4j.audit.AuditConstants;
+import org.apache.knox.gateway.audit.log4j.correlation.Log4jCorrelationContext;
 import org.apache.knox.gateway.audit.log4j.layout.AuditLayout;
 import org.apache.knox.test.log.CollectAppender;
-import org.apache.log4j.LogManager;
-import org.apache.log4j.PropertyConfigurator;
-import org.apache.log4j.spi.LoggingEvent;
+import org.apache.logging.log4j.core.LogEvent;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
-import java.io.File;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.Locale;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.MatcherAssert.assertThat;
-
 public class AuditLayoutTest {
   private static AuditService auditService = AuditServiceFactory.getAuditService();
   private static CorrelationService correlationService = CorrelationServiceFactory
       .getCorrelationService();
   private static Auditor auditor = auditService.getAuditor( "audit.forward", AuditConstants.KNOX_COMPONENT_NAME, AuditConstants.KNOX_SERVICE_NAME );
-  private static AuditLayout layout = new AuditLayout();
+  private static AuditLayout layout = new AuditLayout(StandardCharsets.UTF_8);
 
   private static final String USERNAME = "username";
   private static final String PROXYUSERNAME = "proxy_username";
@@ -66,10 +65,6 @@ public class AuditLayoutTest {
   private static final String EMPTY = "";
   private static final String RECORD_PATTERN = "%s %s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s%s";
 
-  static {
-    layout.activateOptions();
-  }
-
   @Before
   public void setUp() {
     tearDown();
@@ -80,7 +75,6 @@ public class AuditLayoutTest {
     CollectAppender.queue.clear();
     auditService.detachContext();
     correlationService.detachContext();
-    LogManager.shutdown();
     String absolutePath = "target/audit";
     File db = new File( absolutePath + ".db" );
     if( db.exists() ) {
@@ -90,7 +84,6 @@ public class AuditLayoutTest {
     if( lg.exists() ) {
       assertThat( "Failed to delete audit store lg file.", lg.delete(), is( true ) );
     }
-    PropertyConfigurator.configure( ClassLoader.getSystemResourceAsStream( "audit-log4j.properties" ) );
   }
 
   @Test
@@ -103,23 +96,24 @@ public class AuditLayoutTest {
     auditContext.setRemoteIp( HOST_ADDRESS );
     auditContext.setTargetServiceName( TARGET_SERVICE );
 
-    CorrelationContext correlationContext = correlationService.createContext();
-    correlationContext.setRequestId( REQUEST_ID );
-    correlationContext.setParentRequestId( PARENT_REQUEST_ID );
-    correlationContext.setRootRequestId( ROOT_REQUEST_ID );
+    auditService.attachContext(auditContext);
+
+    CorrelationContext correlationContext = new Log4jCorrelationContext(
+            REQUEST_ID, PARENT_REQUEST_ID, ROOT_REQUEST_ID);
+    correlationService.attachContext(correlationContext);
     auditor.audit( ACTION, RESOURCE_NAME, RESOURCE_TYPE, OUTCOME, MESSAGE );
 
     assertThat( CollectAppender.queue.size(), is( 1 ) );
-    LoggingEvent event = CollectAppender.queue.iterator().next();
+    LogEvent event = CollectAppender.queue.iterator().next();
     SimpleDateFormat format = new SimpleDateFormat( "yy/MM/dd HH:mm:ss", Locale.getDefault() );
-    String formatedDate = format.format( new Date( event.getTimeStamp() ) );
+    String formatedDate = format.format( event.getTimeMillis() );
     //14/01/24 12:40:24 1|2|3|audit.forward|hostaddress|WEBHDFS|username|proxy_username|system_username|action|resource_type|resource_name|outcome|message
     String expectedOutput = String.format(Locale.ROOT,
         RECORD_PATTERN, formatedDate,
         ROOT_REQUEST_ID, PARENT_REQUEST_ID, REQUEST_ID, "audit.forward",
         HOST_ADDRESS, TARGET_SERVICE, USERNAME, PROXYUSERNAME, SYSTEMUSERNAME, ACTION,
-        RESOURCE_TYPE, RESOURCE_NAME, OUTCOME, MESSAGE, AuditLayout.LINE_SEP );
-    String auditOutput = layout.format( event );
+        RESOURCE_TYPE, RESOURCE_NAME, OUTCOME, MESSAGE, System.lineSeparator() );
+    String auditOutput = layout.toSerializable( event );
     assertThat( auditOutput, is( expectedOutput ) );
   }
 
@@ -127,15 +121,15 @@ public class AuditLayoutTest {
   public void testAuditEventWithoutContexts() {
     auditor.audit( ACTION, RESOURCE_NAME, RESOURCE_TYPE, OUTCOME, MESSAGE );
     assertThat( CollectAppender.queue.size(), is( 1 ) );
-    LoggingEvent event = CollectAppender.queue.iterator().next();
+    LogEvent event = CollectAppender.queue.iterator().next();
     SimpleDateFormat format = new SimpleDateFormat( "yy/MM/dd HH:mm:ss", Locale.getDefault() );
-    String formatedDate = format.format( new Date( event.getTimeStamp() ) );
+    String formatedDate = format.format( event.getTimeMillis() );
     //14/01/24 12:41:47 |||audit.forward|||||action|resource_type|resource_name|outcome|message
     String expectedOutput = String.format( Locale.ROOT,
         RECORD_PATTERN, formatedDate,
         EMPTY, EMPTY, EMPTY, "audit.forward",
-        EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, ACTION, RESOURCE_TYPE, RESOURCE_NAME, OUTCOME, MESSAGE, AuditLayout.LINE_SEP );
-    String auditOutput = layout.format( event );
+        EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, ACTION, RESOURCE_TYPE, RESOURCE_NAME, OUTCOME, MESSAGE, System.lineSeparator() );
+    String auditOutput = layout.toSerializable( event );
     assertThat( auditOutput, is( expectedOutput ) );
   }
 
@@ -143,15 +137,15 @@ public class AuditLayoutTest {
   public void testAuditEventWithoutMessage() {
     auditor.audit( ACTION, RESOURCE_NAME, RESOURCE_TYPE, OUTCOME );
     assertThat( CollectAppender.queue.size(), is( 1 ) );
-    LoggingEvent event = CollectAppender.queue.iterator().next();
+    LogEvent event = CollectAppender.queue.iterator().next();
     SimpleDateFormat format = new SimpleDateFormat( "yy/MM/dd HH:mm:ss", Locale.getDefault() );
-    String formatedDate = format.format( new Date( event.getTimeStamp() ) );
+    String formatedDate = format.format(event.getTimeMillis());
     //14/01/24 12:41:47 |||audit.forward|||||action|resource_type|resource_name|outcome|
     String expectedOutput = String.format( Locale.ROOT,
         RECORD_PATTERN, formatedDate,
         EMPTY, EMPTY, EMPTY, "audit.forward",
-        EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, ACTION, RESOURCE_TYPE, RESOURCE_NAME, OUTCOME, EMPTY, AuditLayout.LINE_SEP );
-    String auditOutput = layout.format( event );
+        EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, ACTION, RESOURCE_TYPE, RESOURCE_NAME, OUTCOME, EMPTY, System.lineSeparator() );
+    String auditOutput = layout.toSerializable( event );
     assertThat( auditOutput, is( expectedOutput ) );
   }
 }
diff --git a/gateway-util-common/src/test/java/org/apache/knox/gateway/audit/AuditServiceTest.java b/gateway-util-common/src/test/java/org/apache/knox/gateway/audit/AuditServiceTest.java
index 039856d..f615a43 100644
--- a/gateway-util-common/src/test/java/org/apache/knox/gateway/audit/AuditServiceTest.java
+++ b/gateway-util-common/src/test/java/org/apache/knox/gateway/audit/AuditServiceTest.java
@@ -17,6 +17,13 @@
  */
 package org.apache.knox.gateway.audit;
 
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.IsNull.nullValue;
+
+import java.io.File;
+import java.util.Iterator;
+
 import org.apache.knox.gateway.audit.api.AuditContext;
 import org.apache.knox.gateway.audit.api.AuditService;
 import org.apache.knox.gateway.audit.api.AuditServiceFactory;
@@ -25,24 +32,15 @@ import org.apache.knox.gateway.audit.api.CorrelationContext;
 import org.apache.knox.gateway.audit.api.CorrelationService;
 import org.apache.knox.gateway.audit.api.CorrelationServiceFactory;
 import org.apache.knox.gateway.audit.log4j.audit.AuditConstants;
-import org.apache.knox.gateway.audit.log4j.audit.Log4jAuditService;
-import org.apache.knox.gateway.audit.log4j.correlation.Log4jCorrelationService;
+import org.apache.knox.gateway.audit.log4j.audit.Log4jAuditContext;
+import org.apache.knox.gateway.audit.log4j.correlation.Log4jCorrelationContext;
 import org.apache.knox.test.log.CollectAppender;
-import org.apache.log4j.LogManager;
-import org.apache.log4j.PropertyConfigurator;
-import org.apache.log4j.spi.LoggingEvent;
+import org.apache.logging.log4j.core.LogEvent;
+import org.apache.logging.log4j.util.ReadOnlyStringMap;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
-import java.io.File;
-import java.util.Iterator;
-import java.util.UUID;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.IsNull.nullValue;
-
 public class AuditServiceTest {
   private static AuditService auditService = AuditServiceFactory.getAuditService();
   private static CorrelationService correlationService = CorrelationServiceFactory.getCorrelationService();
@@ -62,7 +60,6 @@ public class AuditServiceTest {
   @After
   public void tearDown() {
     CollectAppender.queue.clear();
-    LogManager.shutdown();
     String absolutePath = "target/audit";
     File db = new File( absolutePath + ".db" );
     if( db.exists() ) {
@@ -72,7 +69,6 @@ public class AuditServiceTest {
     if( lg.exists() ) {
       assertThat( "Failed to delete audit store lg file.", lg.delete(), is( true ) );
     }
-    PropertyConfigurator.configure( ClassLoader.getSystemResourceAsStream( "audit-log4j.properties" ) );
   }
 
   @Test
@@ -86,10 +82,10 @@ public class AuditServiceTest {
     ac.setRemoteHostname( remoteHostname );
     ac.setTargetServiceName( targetServiceName );
 
-    CorrelationContext cc = correlationService.createContext();
-    cc.setRequestId( UUID.randomUUID().toString() );
-    cc.setParentRequestId( UUID.randomUUID().toString() );
-    cc.setRootRequestId( UUID.randomUUID().toString() );
+    auditService.attachContext(ac);
+
+    CorrelationContext cc = Log4jCorrelationContext.random();
+    correlationService.attachContext(cc);
 
     CollectAppender.queue.clear();
     for( int i = 0; i < iterations; i++ ) {
@@ -101,19 +97,20 @@ public class AuditServiceTest {
     assertThat( CollectAppender.queue.size(), is( iterations ) );
 
     //Verify events number and audit/correlation parameters in each event
-    Iterator<LoggingEvent> iterator = CollectAppender.queue.iterator();
+    Iterator<LogEvent> iterator = CollectAppender.queue.iterator();
     int counter = 0;
     while(iterator.hasNext()) {
-      LoggingEvent event = iterator.next();
+      LogEvent event = iterator.next();
       checkLogEventContexts( event, cc, ac );
 
-      assertThat(event.getMDC( AuditConstants.MDC_ACTION_KEY ), is( "action" + counter ) );
-      assertThat(event.getMDC( AuditConstants.MDC_RESOURCE_NAME_KEY ), is( "resource" + counter ) );
-      assertThat(event.getMDC( AuditConstants.MDC_RESOURCE_TYPE_KEY ), is( "resource type" + counter ) );
-      assertThat(event.getMDC( AuditConstants.MDC_OUTCOME_KEY ), is( "outcome" + counter ) );
-      assertThat(event.getMDC( AuditConstants.MDC_SERVICE_KEY ), is( AuditConstants.KNOX_SERVICE_NAME ) );
-      assertThat(event.getMDC( AuditConstants.MDC_COMPONENT_KEY ), is( AuditConstants.KNOX_COMPONENT_NAME ) );
-      assertThat(event.getRenderedMessage(), is( "message" + counter ) );
+      ReadOnlyStringMap eventContextData = event.getContextData();
+      assertThat( eventContextData.getValue( AuditConstants.MDC_ACTION_KEY ), is( "action" + counter ) );
+      assertThat( eventContextData.getValue( AuditConstants.MDC_RESOURCE_NAME_KEY ), is( "resource" + counter ) );
+      assertThat( eventContextData.getValue( AuditConstants.MDC_RESOURCE_TYPE_KEY ), is( "resource type" + counter ) );
+      assertThat( eventContextData.getValue( AuditConstants.MDC_OUTCOME_KEY ), is( "outcome" + counter ) );
+      assertThat( eventContextData.getValue( AuditConstants.MDC_SERVICE_KEY ), is( AuditConstants.KNOX_SERVICE_NAME ) );
+      assertThat( eventContextData.getValue( AuditConstants.MDC_COMPONENT_KEY ), is( AuditConstants.KNOX_COMPONENT_NAME ) );
+      assertThat( event.getMessage().getFormattedMessage(), is( "message" + counter ) );
 
       counter++;
     }
@@ -130,10 +127,10 @@ public class AuditServiceTest {
     ac.setRemoteHostname( remoteHostname );
     ac.setTargetServiceName( targetServiceName );
 
-    CorrelationContext cc = correlationService.createContext();
-    cc.setRequestId( UUID.randomUUID().toString() );
-    cc.setParentRequestId( UUID.randomUUID().toString() );
-    cc.setRootRequestId( UUID.randomUUID().toString() );
+    auditService.attachContext(ac);
+
+    CorrelationContext cc = Log4jCorrelationContext.random();
+    correlationService.attachContext(cc);
 
     auditor.audit( "action", "resource", "resource type", "outcome", "message" );
 
@@ -141,7 +138,7 @@ public class AuditServiceTest {
     correlationService.detachContext();
 
     assertThat( CollectAppender.queue.size(), is( 1 ) );
-    LoggingEvent event = CollectAppender.queue.iterator().next();
+    LogEvent event = CollectAppender.queue.iterator().next();
     checkLogEventContexts( event, cc, ac );
 
     CollectAppender.queue.clear();
@@ -153,10 +150,10 @@ public class AuditServiceTest {
     ac.setRemoteHostname( remoteHostname + "1" );
     ac.setTargetServiceName( targetServiceName + "1" );
 
-    cc = correlationService.createContext();
-    cc.setRequestId( UUID.randomUUID().toString() );
-    cc.setParentRequestId( UUID.randomUUID().toString() );
-    cc.setRootRequestId( UUID.randomUUID().toString() );
+    auditService.attachContext(ac);
+
+    cc = Log4jCorrelationContext.random();
+    correlationService.attachContext(cc);
 
     auditor.audit( "action", "resource", "resource type", "outcome", "message" );
 
@@ -168,8 +165,8 @@ public class AuditServiceTest {
     checkLogEventContexts( event, cc, ac );
   }
 
-  private void checkLogEventContexts( LoggingEvent event, CorrelationContext expectedCorrelationContext, AuditContext expectedAuditContext ) {
-    AuditContext context = (AuditContext) event.getMDC( Log4jAuditService.MDC_AUDIT_CONTEXT_KEY );
+  private void checkLogEventContexts( LogEvent event, CorrelationContext expectedCorrelationContext, AuditContext expectedAuditContext ) {
+    AuditContext context = Log4jAuditContext.of(event);
     assertThat( context.getUsername(), is( expectedAuditContext.getUsername() ) );
     assertThat( context.getProxyUsername(), is( expectedAuditContext.getProxyUsername() ) );
     assertThat( context.getSystemUsername(), is( expectedAuditContext.getSystemUsername() ) );
@@ -177,7 +174,8 @@ public class AuditServiceTest {
     assertThat( context.getRemoteHostname(), is( expectedAuditContext.getRemoteHostname() ) );
     assertThat( context.getTargetServiceName(), is( expectedAuditContext.getTargetServiceName() ) );
 
-    CorrelationContext correlationContext = (CorrelationContext)event.getMDC( Log4jCorrelationService.MDC_CORRELATION_CONTEXT_KEY );
+    CorrelationContext correlationContext = Log4jCorrelationContext.of(event);
+
     assertThat( correlationContext.getRequestId(), is( expectedCorrelationContext.getRequestId() ) );
     assertThat( correlationContext.getRootRequestId(), is( expectedCorrelationContext.getRootRequestId() ) );
     assertThat( correlationContext.getParentRequestId(), is( expectedCorrelationContext.getParentRequestId() ) );
diff --git a/gateway-util-common/src/test/java/org/apache/knox/gateway/audit/JdbmQueueTest.java b/gateway-util-common/src/test/java/org/apache/knox/gateway/audit/JdbmQueueTest.java
index cbe604c..30b929e 100644
--- a/gateway-util-common/src/test/java/org/apache/knox/gateway/audit/JdbmQueueTest.java
+++ b/gateway-util-common/src/test/java/org/apache/knox/gateway/audit/JdbmQueueTest.java
@@ -18,8 +18,6 @@
 package org.apache.knox.gateway.audit;
 
 import org.apache.knox.gateway.audit.log4j.appender.JdbmQueue;
-import org.apache.log4j.LogManager;
-import org.apache.log4j.PropertyConfigurator;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -53,7 +51,6 @@ public class JdbmQueueTest {
       queue.close();
       queue = null;
     }
-    LogManager.shutdown();
     String absolutePath = "target/audit";
     File db = new File( absolutePath + ".db" );
     if( db.exists() ) {
@@ -63,7 +60,6 @@ public class JdbmQueueTest {
     if( lg.exists() ) {
       assertThat( "Failed to delete audit store lg file.", lg.delete(), is( true ) );
     }
-    PropertyConfigurator.configure( ClassLoader.getSystemResourceAsStream( "audit-log4j.properties" ) );
   }
 
   @Test
diff --git a/gateway-util-common/src/test/java/org/apache/knox/gateway/audit/StoreAndForwardAppenderTest.java b/gateway-util-common/src/test/java/org/apache/knox/gateway/audit/StoreAndForwardAppenderTest.java
index ea91fcc..0b6e03a 100644
--- a/gateway-util-common/src/test/java/org/apache/knox/gateway/audit/StoreAndForwardAppenderTest.java
+++ b/gateway-util-common/src/test/java/org/apache/knox/gateway/audit/StoreAndForwardAppenderTest.java
@@ -18,15 +18,13 @@
 package org.apache.knox.gateway.audit;
 
 import org.apache.knox.test.log.CollectAppender;
-import org.apache.log4j.LogManager;
-import org.apache.log4j.Logger;
-import org.apache.log4j.PropertyConfigurator;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
 import java.io.File;
-import java.io.IOException;
 
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.MatcherAssert.assertThat;
@@ -34,13 +32,12 @@ import static org.hamcrest.MatcherAssert.assertThat;
 public class StoreAndForwardAppenderTest {
 
   @Before
-  public void setup() throws IOException {
+  public void setup() throws Exception {
     cleanup();
   }
 
   @After
-  public void cleanup() throws IOException {
-    LogManager.shutdown();
+  public void cleanup() throws Exception {
     String absolutePath = "target/audit";
     File db = new File( absolutePath + ".db" );
     if( db.exists() ) {
@@ -50,7 +47,6 @@ public class StoreAndForwardAppenderTest {
     if( lg.exists() ) {
       assertThat( "Failed to delete audit store lg file.", lg.delete(), is( true ) );
     }
-    PropertyConfigurator.configure( ClassLoader.getSystemResourceAsStream( "audit-log4j.properties" ) );
   }
 
   @Test(timeout = 500000)
@@ -58,7 +54,7 @@ public class StoreAndForwardAppenderTest {
     System.out.println( "Running " + Thread.currentThread().getStackTrace()[1].getClassName() + "#" + Thread.currentThread().getStackTrace()[1].getMethodName() );
 
     int iterations = 1000;
-    Logger logger = Logger.getLogger( "audit.store" );
+    Logger logger = LogManager.getLogger( "audit.store" );
     for( int i = 1; i <= iterations; i++ ) {
       logger.info( Integer.toString( i ) );
     }
diff --git a/gateway-util-common/src/test/resources/audit-log4j.properties b/gateway-util-common/src/test/resources/audit-log4j.properties
deleted file mode 100644
index c4d4fd1..0000000
--- a/gateway-util-common/src/test/resources/audit-log4j.properties
+++ /dev/null
@@ -1,25 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-log4j.rootLogger=ERROR
-
-log4j.logger.audit.store = INFO, audit-store
-log4j.logger.audit.forward = INFO, audit-forward
-
-log4j.appender.audit-store = org.apache.knox.gateway.audit.log4j.appender.JdbmStoreAndForwardAppender
-log4j.appender.audit-store.file = target/audit
-
-log4j.appender.audit-forward = org.apache.knox.test.log.CollectAppender
\ No newline at end of file
diff --git a/gateway-util-common/src/test/resources/log4j2-test.xml b/gateway-util-common/src/test/resources/log4j2-test.xml
new file mode 100644
index 0000000..ae00a2e
--- /dev/null
+++ b/gateway-util-common/src/test/resources/log4j2-test.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<Configuration>
+    <Appenders>
+        <Console name="console" target="SYSTEM_OUT">
+            <PatternLayout pattern="[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n"/>
+        </Console>
+        <CollectAppender name="audit-forward" />
+        <JdbmStoreAndForwardAppender name="audit-store" file="target/audit" />
+    </Appenders>
+    <Loggers>
+        <Root level="error">
+            <AppenderRef ref="console" />
+        </Root>
+        <Logger name="audit.store" level="INFO" additivity="false">
+            <AppenderRef ref="audit-store" />
+        </Logger>
+        <Logger name="audit.forward" level="INFO">
+            <AppenderRef ref="audit-forward" />
+        </Logger>
+    </Loggers>
+</Configuration>
diff --git a/knox-cli-launcher/src/main/resources/META-INF/launcher.cfg b/knox-cli-launcher/src/main/resources/META-INF/launcher.cfg
index 57dce52..efbd136 100644
--- a/knox-cli-launcher/src/main/resources/META-INF/launcher.cfg
+++ b/knox-cli-launcher/src/main/resources/META-INF/launcher.cfg
@@ -15,4 +15,4 @@
 main.class = org.apache.knox.gateway.util.KnoxCLI
 class.path = ../lib/*.jar;../dep/*.jar;../ext;../ext/*.jar
 GATEWAY_HOME=${launcher.dir}/..
-log4j.configuration=${GATEWAY_HOME}/conf/${launcher.name}-log4j.properties
\ No newline at end of file
+log4j.configurationFile=${GATEWAY_HOME}/conf/${launcher.name}-log4j2.xml
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 109de3c..700a701 100644
--- a/pom.xml
+++ b/pom.xml
@@ -234,7 +234,6 @@
         <junit.version>4.13.2</junit.version>
         <lang-tag.version>1.5</lang-tag.version>
         <libpam4j.version>1.11</libpam4j.version>
-        <log4j.version>1.2.17</log4j.version>
         <log4j2.version>2.14.0</log4j2.version>
         <maven-checkstyle-plugin.version>3.1.1</maven-checkstyle-plugin.version>
         <maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
@@ -1505,6 +1504,32 @@
                 <groupId>org.apache.hadoop</groupId>
                 <artifactId>hadoop-auth</artifactId>
                 <version>${hadoop.version}</version>
+                <exclusions>
+                    <exclusion>
+                        <groupId>log4j</groupId>
+                        <artifactId>log4j</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>org.slf4j</groupId>
+                        <artifactId>slf4j-api</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>org.slf4j</groupId>
+                        <artifactId>slf4j-log4j12</artifactId>
+                    </exclusion>
+                </exclusions>
+            </dependency>
+
+            <dependency>
+                <groupId>org.apache.hadoop</groupId>
+                <artifactId>hadoop-annotations</artifactId>
+                <version>${hadoop.version}</version>
+                <exclusions>
+                    <exclusion>
+                        <groupId>jdk.tools</groupId>
+                        <artifactId>jdk.tools</artifactId>
+                    </exclusion>
+                </exclusions>
             </dependency>
 
             <dependency>
@@ -1518,6 +1543,18 @@
                         <artifactId>jdk.tools</artifactId>
                     </exclusion>
                     <exclusion>
+                        <groupId>log4j</groupId>
+                        <artifactId>log4j</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>org.slf4j</groupId>
+                        <artifactId>slf4j-api</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>org.slf4j</groupId>
+                        <artifactId>slf4j-log4j12</artifactId>
+                    </exclusion>
+                    <exclusion>
                         <groupId>org.codehaus.jackson</groupId>
                         <artifactId>jackson-core-asl</artifactId>
                     </exclusion>
@@ -1615,6 +1652,10 @@
                         <artifactId>commons-math</artifactId>
                     </exclusion>
                     <exclusion>
+                        <groupId>jdk.tools</groupId>
+                        <artifactId>jdk.tools</artifactId>
+                    </exclusion>
+                    <exclusion>
                         <groupId>org.apache.hadoop</groupId>
                         <artifactId>hadoop-annotations</artifactId>
                     </exclusion>
@@ -1864,15 +1905,13 @@
             </dependency>
 
             <dependency>
-                <groupId>org.slf4j</groupId>
-                <artifactId>slf4j-api</artifactId>
-                <version>${slf4j.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.slf4j</groupId>
-                <artifactId>slf4j-log4j12</artifactId>
-                <version>${slf4j.version}</version>
+                <groupId>org.apache.logging.log4j</groupId>
+                <artifactId>log4j-bom</artifactId>
+                <version>${log4j2.version}</version>
+                <scope>import</scope>
+                <type>pom</type>
             </dependency>
+
             <dependency>
                 <groupId>org.slf4j</groupId>
                 <artifactId>jcl-over-slf4j</artifactId>
@@ -1880,16 +1919,15 @@
             </dependency>
 
             <dependency>
-                <groupId>log4j</groupId>
-                <artifactId>log4j</artifactId>
-                <version>${log4j.version}</version>
-            </dependency>
-
-            <dependency>
                 <groupId>org.apache.logging.log4j</groupId>
-                <artifactId>log4j-api</artifactId>
+                <artifactId>log4j-slf4j-impl</artifactId>
                 <version>${log4j2.version}</version>
             </dependency>
+            <dependency>
+                <groupId>org.slf4j</groupId>
+                <artifactId>slf4j-api</artifactId>
+                <version>${slf4j.version}</version>
+            </dependency>
 
             <dependency>
                 <groupId>com.google.guava</groupId>
@@ -1946,6 +1984,18 @@
                         <groupId>com.google.code.findbugs</groupId>
                         <artifactId>jsr305</artifactId>
                     </exclusion>
+                    <exclusion>
+                        <groupId>org.slf4j</groupId>
+                        <artifactId>slf4j-api</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>org.slf4j</groupId>
+                        <artifactId>slf4j-log4j12</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>log4j</groupId>
+                        <artifactId>log4j</artifactId>
+                    </exclusion>
                 </exclusions>
             </dependency>
             <dependency>