You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by ay...@apache.org on 2022/04/19 16:34:58 UTC

[bookkeeper] branch master updated: Remove log4j1 from bk test code

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 760b9e019 Remove log4j1 from bk test code
760b9e019 is described below

commit 760b9e0192e954ebcd7b3b302f3b43672da21a58
Author: ZhangJian He <sh...@gmail.com>
AuthorDate: Wed Apr 20 00:34:50 2022 +0800

    Remove log4j1 from bk test code
    
    ### Motivation
    this is a part work of remove log4j1 from bookeeper, first remove it from our test code, unit test and integrate test
    
    ### Changes
    - remove log4j1 scope test dependency
    - use log4j2.xml instread of log4j.properties
    - introduce testtools module to reduce duplication,  if a module needs particular configuration (very unlikely) we can add a log4j2-test.xml file which has precedence over log4j2.xml one. idea from [nicoloboschi](https://github.com/nicoloboschi)
    
    Reviewers: Andrey Yegorov <None>, Enrico Olivelli <eo...@gmail.com>, Nicolò Boschi <bo...@gmail.com>
    
    This closes #3208 from Shoothzj/remove-log4j1-from-bk-test-code2
---
 bookkeeper-benchmark/pom.xml                       | 17 +++--
 .../src/test/resources/log4j.properties            | 72 ----------------------
 bookkeeper-common/build.gradle                     |  1 -
 bookkeeper-common/pom.xml                          | 17 ++---
 .../common/util/TestOrderedExecutorDecorators.java | 14 ++---
 .../src/test/resources/log4j.properties            | 42 -------------
 .../src/main/resources/LICENSE-all.bin.txt         |  4 +-
 .../src/main/resources/LICENSE-bkctl.bin.txt       |  4 +-
 .../src/main/resources/LICENSE-server.bin.txt      |  4 +-
 bookkeeper-http/http-server/pom.xml                |  4 --
 bookkeeper-server/build.gradle                     |  2 +-
 bookkeeper-server/pom.xml                          |  8 +--
 .../bookie/LedgerStorageCheckpointTest.java        |  2 +-
 .../apache/bookkeeper/client/MdcContextTest.java   | 26 ++++----
 .../meta/AbstractZkLedgerManagerTest.java          |  2 +
 .../src/test/resources/log4j.properties            | 42 -------------
 bookkeeper-slogger/slf4j/pom.xml                   |  4 --
 bookkeeper-stats/pom.xml                           |  4 --
 circe-checksum/build.gradle                        |  3 +
 circe-checksum/pom.xml                             |  6 ++
 circe-checksum/src/test/resources/log4j.properties | 42 -------------
 dependencies.gradle                                |  2 +-
 metadata-drivers/etcd/build.gradle                 |  1 +
 metadata-drivers/etcd/pom.xml                      |  6 ++
 .../etcd/src/test/resources/log4j.properties       | 39 ------------
 microbenchmarks/pom.xml                            |  4 --
 pom.xml                                            | 17 ++++-
 settings.gradle                                    |  4 +-
 stream/clients/java/all/build.gradle               |  1 +
 stream/clients/java/all/pom.xml                    |  6 ++
 .../java/all/src/test/resources/log4j.properties   | 53 ----------------
 stream/clients/java/base/build.gradle              |  2 +
 stream/clients/java/base/pom.xml                   |  6 ++
 .../java/base/src/test/resources/log4j.properties  | 51 ---------------
 stream/clients/java/kv/build.gradle                |  1 +
 stream/clients/java/kv/pom.xml                     |  6 ++
 .../java/kv/src/test/resources/log4j.properties    | 51 ---------------
 stream/distributedlog/core/build.gradle            |  1 +
 stream/distributedlog/core/pom.xml                 |  6 ++
 .../core/src/test/resources/log4j.properties       | 51 ---------------
 stream/distributedlog/protocol/build.gradle        |  1 +
 stream/distributedlog/protocol/pom.xml             |  6 ++
 .../protocol/src/test/resources/log4j.properties   | 51 ---------------
 stream/proto/build.gradle                          |  2 +
 stream/proto/pom.xml                               |  6 ++
 stream/proto/src/test/resources/log4j.properties   | 53 ----------------
 stream/server/build.gradle                         |  2 +
 stream/server/pom.xml                              |  6 ++
 stream/server/src/test/resources/log4j.properties  | 53 ----------------
 stream/statelib/build.gradle                       |  1 +
 stream/statelib/pom.xml                            |  6 ++
 .../statelib/src/test/resources/log4j.properties   | 33 ----------
 stream/storage/impl/build.gradle                   |  1 +
 stream/storage/impl/pom.xml                        |  6 ++
 .../impl/src/test/resources/log4j.properties       | 53 ----------------
 tests/integration-tests-base/pom.xml               |  6 --
 .../src/main/resources/log4j.properties            | 37 -----------
 .../src/main}/resources/log4j2.xml                 | 10 +--
 tests/integration/cluster/build.gradle             |  1 +
 tests/integration/cluster/pom.xml                  |  7 +++
 .../cluster/src/test/resources/log4j.properties    | 42 -------------
 tests/integration/standalone/build.gradle          |  1 +
 tests/integration/standalone/pom.xml               |  7 +++
 .../standalone/src/test/resources/log4j.properties | 42 -------------
 {circe-checksum => testtools}/build.gradle         | 30 ++++-----
 {bookkeeper-slogger/slf4j => testtools}/pom.xml    | 24 +++-----
 .../src/main}/resources/log4j2.xml                 | 10 +--
 tools/ledger/build.gradle                          |  1 +
 tools/ledger/pom.xml                               |  6 ++
 tools/ledger/src/test/resources/log4j.properties   | 42 -------------
 70 files changed, 198 insertions(+), 976 deletions(-)

diff --git a/bookkeeper-benchmark/pom.xml b/bookkeeper-benchmark/pom.xml
index d910ee04a..2161747b8 100644
--- a/bookkeeper-benchmark/pom.xml
+++ b/bookkeeper-benchmark/pom.xml
@@ -43,6 +43,17 @@
     </plugins>
   </build>
   <dependencies>
+    <dependency>
+      <groupId>org.apache.bookkeeper</groupId>
+      <artifactId>bookkeeper-server</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.bookkeeper</groupId>
+      <artifactId>testtools</artifactId>
+      <version>${project.parent.version}</version>
+      <scope>test</scope>
+    </dependency>
     <dependency>
       <groupId>org.apache.zookeeper</groupId>
       <artifactId>zookeeper</artifactId>
@@ -61,12 +72,6 @@
        <artifactId>metrics-core</artifactId>
        <scope>test</scope>
     </dependency>
-    <dependency>
-      <groupId>org.apache.bookkeeper</groupId>
-      <artifactId>bookkeeper-server</artifactId>
-      <version>${project.version}</version>
-      <scope>compile</scope>
-    </dependency>
     <dependency>
       <groupId>org.apache.bookkeeper</groupId>
       <artifactId>bookkeeper-common</artifactId>
diff --git a/bookkeeper-benchmark/src/test/resources/log4j.properties b/bookkeeper-benchmark/src/test/resources/log4j.properties
deleted file mode 100644
index c0d9a4213..000000000
--- a/bookkeeper-benchmark/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,72 +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.
-#
-#
-
-#
-# Bookkeeper Logging Configuration
-#
-
-# Format is "<default threshold> (, <appender>)+
-
-# DEFAULT: console appender only
-log4j.rootLogger=INFO, CONSOLE
-
-# Example with rolling log file
-#log4j.rootLogger=DEBUG, CONSOLE, ROLLINGFILE
-
-# Example with rolling log file and tracing
-#log4j.rootLogger=TRACE, CONSOLE, ROLLINGFILE, TRACEFILE
-
-#
-# Log INFO level and above messages to the console
-#
-log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
-log4j.appender.CONSOLE.Threshold=INFO
-log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
-log4j.appender.CONSOLE.layout.ConversionPattern=%d{ISO8601} - %-5p - [%t:%C{1}@%L] - %m%n
-
-#
-# Add ROLLINGFILE to rootLogger to get log file output
-#    Log DEBUG level and above messages to a log file
-log4j.appender.ROLLINGFILE=org.apache.log4j.DailyRollingFileAppender
-log4j.appender.ROLLINGFILE.Threshold=DEBUG
-log4j.appender.ROLLINGFILE.File=bookkeeper-benchmark.log
-log4j.appender.ROLLINGFILE.layout=org.apache.log4j.PatternLayout
-log4j.appender.ROLLINGFILE.layout.ConversionPattern=%d{ISO8601} - %-5p - [%t:%C{1}@%L] - %m%n
-
-# Max log file size of 10MB
-log4j.appender.ROLLINGFILE.MaxFileSize=10MB
-# uncomment the next line to limit number of backup files
-#log4j.appender.ROLLINGFILE.MaxBackupIndex=10
-
-log4j.appender.ROLLINGFILE.layout=org.apache.log4j.PatternLayout
-log4j.appender.ROLLINGFILE.layout.ConversionPattern=%d{ISO8601} - %-5p [%t:%C{1}@%L] - %m%n
-
-
-#
-# Add TRACEFILE to rootLogger to get log file output
-#    Log DEBUG level and above messages to a log file
-log4j.appender.TRACEFILE=org.apache.log4j.FileAppender
-log4j.appender.TRACEFILE.Threshold=TRACE
-log4j.appender.TRACEFILE.File=bookkeeper_trace.log
-
-log4j.appender.TRACEFILE.layout=org.apache.log4j.PatternLayout
-### Notice we are including log4j's NDC here (%x)
-log4j.appender.TRACEFILE.layout.ConversionPattern=%d{ISO8601} - %-5p [%t:%C{1}@%L][%x] - %m%n
diff --git a/bookkeeper-common/build.gradle b/bookkeeper-common/build.gradle
index 9699d0937..c133ac776 100644
--- a/bookkeeper-common/build.gradle
+++ b/bookkeeper-common/build.gradle
@@ -45,7 +45,6 @@ dependencies {
     testImplementation depLibs.hamcrest
     testImplementation depLibs.junit
     testImplementation depLibs.log4jSlf4jImpl
-    testImplementation depLibs.log4j12api
     testImplementation depLibs.log4jCore
     testImplementation depLibs.mockito
 
diff --git a/bookkeeper-common/pom.xml b/bookkeeper-common/pom.xml
index 01826f570..c88a002f8 100644
--- a/bookkeeper-common/pom.xml
+++ b/bookkeeper-common/pom.xml
@@ -75,20 +75,15 @@
       <artifactId>rxjava</artifactId>
     </dependency>
     <dependency>
-      <groupId>org.apache.commons</groupId>
-      <artifactId>commons-lang3</artifactId>
+      <groupId>org.apache.bookkeeper</groupId>
+      <artifactId>testtools</artifactId>
+      <version>${project.parent.version}</version>
       <scope>test</scope>
     </dependency>
     <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-api</artifactId>
-      <version>${slf4j.version}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.logging.log4j</groupId>
-      <artifactId>log4j-1.2-api</artifactId>
-      <version>${log4j.version}</version>
-      <scope>test</scope> <!-- There are tests that rely on this binding in their test logic -->
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-lang3</artifactId>
+      <scope>test</scope>
     </dependency>
     <dependency>
       <groupId>org.apache.logging.log4j</groupId>
diff --git a/bookkeeper-common/src/test/java/org/apache/bookkeeper/common/util/TestOrderedExecutorDecorators.java b/bookkeeper-common/src/test/java/org/apache/bookkeeper/common/util/TestOrderedExecutorDecorators.java
index f8d53b496..d12c19ee2 100644
--- a/bookkeeper-common/src/test/java/org/apache/bookkeeper/common/util/TestOrderedExecutorDecorators.java
+++ b/bookkeeper-common/src/test/java/org/apache/bookkeeper/common/util/TestOrderedExecutorDecorators.java
@@ -34,8 +34,8 @@ import java.util.UUID;
 import java.util.concurrent.ConcurrentLinkedQueue;
 import java.util.concurrent.TimeUnit;
 
-import org.apache.log4j.MDC;
 import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.ThreadContext;
 import org.apache.logging.log4j.core.LogEvent;
 import org.apache.logging.log4j.core.LoggerContext;
 import org.apache.logging.log4j.core.appender.NullAppender;
@@ -62,7 +62,7 @@ public class TestOrderedExecutorDecorators {
 
     @Before
     public void setUp() throws Exception {
-        MDC.clear();
+        ThreadContext.clearMap();
         LoggerContext lc = (LoggerContext) org.apache.logging.log4j.LogManager.getContext(false);
         mockAppender = spy(NullAppender.createAppender(UUID.randomUUID().toString()));
         mockAppender.start();
@@ -83,7 +83,7 @@ public class TestOrderedExecutorDecorators {
         lc.getRootLogger().removeAppender(lc.getConfiguration().getAppender(mockAppender.getName()));
         lc.updateLoggers();
         capturedEvents.clear();
-        MDC.clear();
+        ThreadContext.clearMap();
     }
 
     @Test
@@ -92,7 +92,7 @@ public class TestOrderedExecutorDecorators {
             .name("test").numThreads(20).preserveMdcForTaskExecution(true).build();
 
         try {
-            MDC.put(MDC_KEY, "testMDCInvokeOrdered");
+            ThreadContext.put(MDC_KEY, "testMDCInvokeOrdered");
             executor.submitOrdered(10, () -> {
                     log.info("foobar");
                     return 10;
@@ -110,7 +110,7 @@ public class TestOrderedExecutorDecorators {
             .name("test").numThreads(20).preserveMdcForTaskExecution(true).build();
 
         try {
-            MDC.put(MDC_KEY, "testMDCInvokeOrdered");
+            ThreadContext.put(MDC_KEY, "testMDCInvokeOrdered");
             executor.chooseThread(10).submit(() -> {
                     log.info("foobar");
                     return 10;
@@ -130,7 +130,7 @@ public class TestOrderedExecutorDecorators {
             .name("test").numThreads(20).preserveMdcForTaskExecution(true).build();
 
         try {
-            MDC.put(MDC_KEY, "testMDCInvokeOrdered");
+            ThreadContext.put(MDC_KEY, "testMDCInvokeOrdered");
             scheduler.scheduleOrdered(10, safeRun(() -> {
                         log.info("foobar");
                     }), 0, TimeUnit.DAYS).get();
@@ -147,7 +147,7 @@ public class TestOrderedExecutorDecorators {
             .name("test").numThreads(20).preserveMdcForTaskExecution(true).build();
 
         try {
-            MDC.put(MDC_KEY, "testMDCInvokeOrdered");
+            ThreadContext.put(MDC_KEY, "testMDCInvokeOrdered");
             scheduler.chooseThread(10).schedule(safeRun(() -> {
                         log.info("foobar");
                     }), 0, TimeUnit.DAYS).get();
diff --git a/bookkeeper-common/src/test/resources/log4j.properties b/bookkeeper-common/src/test/resources/log4j.properties
deleted file mode 100644
index 10ae6bfcb..000000000
--- a/bookkeeper-common/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,42 +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.
-#
-#
-
-#
-# Bookkeeper Logging Configuration
-#
-
-# Format is "<default threshold> (, <appender>)+
-
-# DEFAULT: console appender only, level INFO
-bookkeeper.root.logger=INFO,CONSOLE
-log4j.rootLogger=${bookkeeper.root.logger}
-
-#
-# Log INFO level and above messages to the console
-#
-log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
-log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
-log4j.appender.CONSOLE.layout.ConversionPattern=%d{ISO8601} - %-5p - [%t:%C{1}@%L] - %m%n
-
-#disable zookeeper logging
-log4j.logger.org.apache.zookeeper=OFF
-log4j.logger.org.apache.bookkeeper.bookie=INFO
-log4j.logger.org.apache.bookkeeper.meta=INFO
diff --git a/bookkeeper-dist/src/main/resources/LICENSE-all.bin.txt b/bookkeeper-dist/src/main/resources/LICENSE-all.bin.txt
index b2223d510..1ff2c942f 100644
--- a/bookkeeper-dist/src/main/resources/LICENSE-all.bin.txt
+++ b/bookkeeper-dist/src/main/resources/LICENSE-all.bin.txt
@@ -311,7 +311,7 @@ Apache Software License, Version 2.
 - lib/io.dropwizard.metrics-metrics-jvm-3.2.5.jar [47]
 - lib/io.perfmark-perfmark-api-0.23.0.jar [48]
 - lib/org.conscrypt-conscrypt-openjdk-uber-2.5.1.jar [49]
-- lib/org.xerial.snappy-snappy-java-1.1.7.jar [50]
+- lib/org.xerial.snappy-snappy-java-1.1.7.7.jar [50]
 - lib/io.reactivex.rxjava3-rxjava-3.0.1.jar [51]
 
 [1] Source available at https://github.com/FasterXML/jackson-annotations/tree/jackson-annotations-2.11.0
@@ -360,7 +360,7 @@ Apache Software License, Version 2.
 [47] Source available at https://github.com/dropwizard/metrics/releases/tag/v3.2.5
 [48] Source available at https://github.com/perfmark/perfmark/releases/tag/v0.23.0
 [49] Source available at https://github.com/google/conscrypt/releases/tag/2.5.1
-[50] Source available at https://github.com/google/snappy/releases/tag/1.1.7
+[50] Source available at https://github.com/google/snappy/releases/tag/1.1.7.7
 [51] Source available at https://github.com/ReactiveX/RxJava/tree/v3.0.1
 
 ------------------------------------------------------------------------------------
diff --git a/bookkeeper-dist/src/main/resources/LICENSE-bkctl.bin.txt b/bookkeeper-dist/src/main/resources/LICENSE-bkctl.bin.txt
index 1e9c2b56e..19eaf8af3 100644
--- a/bookkeeper-dist/src/main/resources/LICENSE-bkctl.bin.txt
+++ b/bookkeeper-dist/src/main/resources/LICENSE-bkctl.bin.txt
@@ -288,7 +288,7 @@ Apache Software License, Version 2.
 - lib/io.dropwizard.metrics-metrics-core-3.2.5.jar [46]
 - lib/io.perfmark-perfmark-api-0.23.0.jar [47]
 - lib/org.conscrypt-conscrypt-openjdk-uber-2.5.1.jar [49]
-- lib/org.xerial.snappy-snappy-java-1.1.7.jar [50]
+- lib/org.xerial.snappy-snappy-java-1.1.7.7.jar [50]
 - lib/io.reactivex.rxjava3-rxjava-3.0.1.jar [51]
 
 [1] Source available at https://github.com/FasterXML/jackson-annotations/tree/jackson-annotations-2.11.0
@@ -329,7 +329,7 @@ Apache Software License, Version 2.
 [46] Source available at https://github.com/dropwizard/metrics/releases/tag/v3.1.0
 [47] Source available at https://github.com/perfmark/perfmark/releases/tag/v0.23.0
 [49] Source available at https://github.com/google/conscrypt/releases/tag/2.5.1
-[50] Source available at https://github.com/google/snappy/releases/tag/1.1.7
+[50] Source available at https://github.com/google/snappy/releases/tag/1.1.7.7
 [51] Source available at https://github.com/ReactiveX/RxJava/tree/v3.0.1
 
 ------------------------------------------------------------------------------------
diff --git a/bookkeeper-dist/src/main/resources/LICENSE-server.bin.txt b/bookkeeper-dist/src/main/resources/LICENSE-server.bin.txt
index a01249ff4..73cb344fa 100644
--- a/bookkeeper-dist/src/main/resources/LICENSE-server.bin.txt
+++ b/bookkeeper-dist/src/main/resources/LICENSE-server.bin.txt
@@ -309,7 +309,7 @@ Apache Software License, Version 2.
 - lib/io.dropwizard.metrics-metrics-core-3.2.5.jar [47]
 - lib/io.perfmark-perfmark-api-0.23.0.jar [48]
 - lib/org.conscrypt-conscrypt-openjdk-uber-2.5.1.jar [49]
-- lib/org.xerial.snappy-snappy-java-1.1.7.jar [50]
+- lib/org.xerial.snappy-snappy-java-1.1.7.7.jar [50]
 - lib/io.reactivex.rxjava3-rxjava-3.0.1.jar [51]
 
 [1] Source available at https://github.com/FasterXML/jackson-annotations/tree/jackson-annotations-2.11.0
@@ -358,7 +358,7 @@ Apache Software License, Version 2.
 [47] Source available at https://github.com/dropwizard/metrics/releases/tag/v3.2.5
 [48] Source available at https://github.com/perfmark/perfmark/releases/tag/v0.23.0
 [49] Source available at https://github.com/google/conscrypt/releases/tag/2.5.1
-[50] Source available at https://github.com/google/snappy/releases/tag/1.1.7
+[50] Source available at https://github.com/google/snappy/releases/tag/1.1.7.7
 [51] Source available at https://github.com/ReactiveX/RxJava/tree/v3.0.1
 
 ------------------------------------------------------------------------------------
diff --git a/bookkeeper-http/http-server/pom.xml b/bookkeeper-http/http-server/pom.xml
index b05d651bc..b14ad46a9 100644
--- a/bookkeeper-http/http-server/pom.xml
+++ b/bookkeeper-http/http-server/pom.xml
@@ -28,10 +28,6 @@
   <name>Apache BookKeeper :: Http :: Http Server</name>
   <url>http://maven.apache.org</url>
   <dependencies>
-    <dependency>
-      <groupId>commons-configuration</groupId>
-      <artifactId>commons-configuration</artifactId>
-    </dependency>
     <dependency>
       <groupId>com.fasterxml.jackson.core</groupId>
       <artifactId>jackson-core</artifactId>
diff --git a/bookkeeper-server/build.gradle b/bookkeeper-server/build.gradle
index 2d48d6b27..cef8e64e1 100644
--- a/bookkeeper-server/build.gradle
+++ b/bookkeeper-server/build.gradle
@@ -57,6 +57,7 @@ dependencies {
     runtimeOnly depLibs.metricsCore
     runtimeOnly depLibs.snappy
 
+    testImplementation project(':testtools')
     testImplementation project(':bookkeeper-stats-providers:prometheus-metrics-provider')
     testImplementation project(':bookkeeper-http:vertx-http-server')
     testImplementation project(path: ':bookkeeper-common', configuration: 'testArtifacts')
@@ -76,7 +77,6 @@ dependencies {
     annotationProcessor depLibs.lombok
     testAnnotationProcessor depLibs.lombok
     testImplementation depLibs.log4jSlf4jImpl
-    testImplementation depLibs.log4j12api
     testImplementation depLibs.log4jCore
 }
 
diff --git a/bookkeeper-server/pom.xml b/bookkeeper-server/pom.xml
index c21a2d69d..b51615c58 100644
--- a/bookkeeper-server/pom.xml
+++ b/bookkeeper-server/pom.xml
@@ -50,10 +50,10 @@
       <artifactId>rocksdbjni</artifactId>
     </dependency>
     <dependency>
-      <groupId>org.apache.logging.log4j</groupId>
-      <artifactId>log4j-1.2-api</artifactId>
-      <version>${log4j.version}</version>
-      <scope>test</scope> <!-- There are tests that rely on this binding in their test logic -->
+      <groupId>org.apache.bookkeeper</groupId>
+      <artifactId>testtools</artifactId>
+      <version>${project.parent.version}</version>
+      <scope>test</scope>
     </dependency>
     <dependency>
       <groupId>org.apache.logging.log4j</groupId>
diff --git a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/LedgerStorageCheckpointTest.java b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/LedgerStorageCheckpointTest.java
index d62c8697c..222e26807 100644
--- a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/LedgerStorageCheckpointTest.java
+++ b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/LedgerStorageCheckpointTest.java
@@ -79,7 +79,7 @@ import org.slf4j.LoggerFactory;
  */
 @RunWith(PowerMockRunner.class)
 @PrepareForTest(SyncThread.class)
-@PowerMockIgnore("javax.*")
+@PowerMockIgnore({"java.*", "javax.*", "org.slf4j.*"})
 public class LedgerStorageCheckpointTest {
     private static final Logger LOG = LoggerFactory
             .getLogger(LedgerStorageCheckpointTest.class);
diff --git a/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/MdcContextTest.java b/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/MdcContextTest.java
index 51d66d840..055ac0d92 100644
--- a/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/MdcContextTest.java
+++ b/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/MdcContextTest.java
@@ -43,7 +43,7 @@ import org.apache.bookkeeper.bookie.InterleavedLedgerStorage;
 import org.apache.bookkeeper.bookie.LedgerDirsManager;
 import org.apache.bookkeeper.conf.ClientConfiguration;
 import org.apache.bookkeeper.test.BookKeeperClusterTestCase;
-import org.apache.log4j.MDC;
+import org.apache.logging.log4j.ThreadContext;
 import org.apache.logging.log4j.core.LogEvent;
 import org.apache.logging.log4j.core.LoggerContext;
 import org.apache.logging.log4j.core.appender.NullAppender;
@@ -87,7 +87,7 @@ public class MdcContextTest extends BookKeeperClusterTestCase {
     public static String mdcFormat(Object mdc, String message) {
         return mdc == null
                 ? "[" + MDC_REQUEST_ID + ":] - " + message
-                : "[" + MDC_REQUEST_ID + ":" + mdc.toString()
+                : "[" + MDC_REQUEST_ID + ":" + mdc
                 + "] - " + message;
     }
 
@@ -107,13 +107,13 @@ public class MdcContextTest extends BookKeeperClusterTestCase {
                 .setMetadataServiceUri(zkUtil.getMetadataServiceUri())
                 .setPreserveMdcForTaskExecution(true);
 
-        MDC.clear();
+        ThreadContext.clearMap();
         bkc = new BookKeeper(conf);
 
-        MDC.put(MDC_REQUEST_ID, "ledger_create");
+        ThreadContext.put(MDC_REQUEST_ID, "ledger_create");
         log.info("creating ledger");
         lh = bkc.createLedgerAdv(3, 3, 3, BookKeeper.DigestType.CRC32, new byte[] {});
-        MDC.clear();
+        ThreadContext.clearMap();
 
         LoggerContext lc = (LoggerContext) org.apache.logging.log4j.LogManager.getContext(false);
         mockAppender = spy(NullAppender.createAppender(UUID.randomUUID().toString()));
@@ -138,13 +138,13 @@ public class MdcContextTest extends BookKeeperClusterTestCase {
         lc.getRootLogger().removeAppender(lc.getConfiguration().getAppender(mockAppender.getName()));
         lc.updateLoggers();
         capturedEvents = null;
-        MDC.clear();
+        ThreadContext.clearMap();
         super.tearDown();
     }
 
     @Test
     public void testLedgerCreateFails() throws Exception {
-        MDC.put(MDC_REQUEST_ID, "ledger_create_fail");
+        ThreadContext.put(MDC_REQUEST_ID, "ledger_create_fail");
         try {
             bkc.createLedgerAdv(99, 3, 2, BookKeeper.DigestType.CRC32, new byte[]{});
             Assert.fail("should not get here");
@@ -156,7 +156,7 @@ public class MdcContextTest extends BookKeeperClusterTestCase {
 
     @Test
     public void testSimpleAdd() throws Exception {
-        MDC.put(MDC_REQUEST_ID, "ledger_add_entry");
+        ThreadContext.put(MDC_REQUEST_ID, "ledger_add_entry");
         lh.addEntry(0, entry);
 
         // client msg
@@ -171,7 +171,7 @@ public class MdcContextTest extends BookKeeperClusterTestCase {
         startNewBookie();
         killBookie(0);
 
-        MDC.put(MDC_REQUEST_ID, "ledger_add_entry");
+        ThreadContext.put(MDC_REQUEST_ID, "ledger_add_entry");
         lh.addEntry(1, entry);
         assertLogWithMdc("ledger_add_entry", "Could not connect to bookie");
         assertLogWithMdc("ledger_add_entry", "Failed to write entry");
@@ -189,7 +189,7 @@ public class MdcContextTest extends BookKeeperClusterTestCase {
             ledgerDirsManager.addToFilledDirs(new File(ledgerDirs[0], "current"));
         }
 
-        MDC.put(MDC_REQUEST_ID, "ledger_add_entry");
+        ThreadContext.put(MDC_REQUEST_ID, "ledger_add_entry");
         try {
             lh.addEntry(0, entry);
             Assert.fail("should not get here");
@@ -209,7 +209,7 @@ public class MdcContextTest extends BookKeeperClusterTestCase {
     public void testAddFailsDuplicateEntry() throws Exception {
         lh.addEntry(0, entry);
 
-        MDC.put(MDC_REQUEST_ID, "ledger_add_duplicate_entry");
+        ThreadContext.put(MDC_REQUEST_ID, "ledger_add_duplicate_entry");
         try {
             lh.addEntry(0, entry);
             Assert.fail("should not get here");
@@ -223,7 +223,7 @@ public class MdcContextTest extends BookKeeperClusterTestCase {
 
     @Test
     public void testReadEntryBeyondLac() throws Exception {
-        MDC.put(MDC_REQUEST_ID, "ledger_read_entry");
+        ThreadContext.put(MDC_REQUEST_ID, "ledger_read_entry");
 
         try {
             lh.readEntries(100, 100);
@@ -240,7 +240,7 @@ public class MdcContextTest extends BookKeeperClusterTestCase {
         lh.close();
         bkc.deleteLedger(lh.ledgerId);
 
-        MDC.put(MDC_REQUEST_ID, "ledger_read_entry");
+        ThreadContext.put(MDC_REQUEST_ID, "ledger_read_entry");
 
         try {
             lh.readEntries(100, 100);
diff --git a/bookkeeper-server/src/test/java/org/apache/bookkeeper/meta/AbstractZkLedgerManagerTest.java b/bookkeeper-server/src/test/java/org/apache/bookkeeper/meta/AbstractZkLedgerManagerTest.java
index f9de13d85..5c6a514a7 100644
--- a/bookkeeper-server/src/test/java/org/apache/bookkeeper/meta/AbstractZkLedgerManagerTest.java
+++ b/bookkeeper-server/src/test/java/org/apache/bookkeeper/meta/AbstractZkLedgerManagerTest.java
@@ -78,6 +78,7 @@ import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PowerMockIgnore;
 import org.powermock.core.classloader.annotations.PrepareForTest;
 import org.powermock.modules.junit4.PowerMockRunner;
 
@@ -85,6 +86,7 @@ import org.powermock.modules.junit4.PowerMockRunner;
  * Unit test of {@link AbstractZkLedgerManager}.
  */
 @RunWith(PowerMockRunner.class)
+@PowerMockIgnore("javax.management.*")
 @PrepareForTest({ AbstractZkLedgerManager.class, ZkUtils.class })
 public class AbstractZkLedgerManagerTest extends MockZooKeeperTestCase {
 
diff --git a/bookkeeper-server/src/test/resources/log4j.properties b/bookkeeper-server/src/test/resources/log4j.properties
deleted file mode 100644
index 10ae6bfcb..000000000
--- a/bookkeeper-server/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,42 +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.
-#
-#
-
-#
-# Bookkeeper Logging Configuration
-#
-
-# Format is "<default threshold> (, <appender>)+
-
-# DEFAULT: console appender only, level INFO
-bookkeeper.root.logger=INFO,CONSOLE
-log4j.rootLogger=${bookkeeper.root.logger}
-
-#
-# Log INFO level and above messages to the console
-#
-log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
-log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
-log4j.appender.CONSOLE.layout.ConversionPattern=%d{ISO8601} - %-5p - [%t:%C{1}@%L] - %m%n
-
-#disable zookeeper logging
-log4j.logger.org.apache.zookeeper=OFF
-log4j.logger.org.apache.bookkeeper.bookie=INFO
-log4j.logger.org.apache.bookkeeper.meta=INFO
diff --git a/bookkeeper-slogger/slf4j/pom.xml b/bookkeeper-slogger/slf4j/pom.xml
index b44203517..0f3c98ef3 100644
--- a/bookkeeper-slogger/slf4j/pom.xml
+++ b/bookkeeper-slogger/slf4j/pom.xml
@@ -30,9 +30,5 @@
             <artifactId>bookkeeper-slogger-api</artifactId>
             <version>${project.parent.version}</version>
         </dependency>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-api</artifactId>
-        </dependency>
     </dependencies>
 </project>
diff --git a/bookkeeper-stats/pom.xml b/bookkeeper-stats/pom.xml
index 41736c435..76a6cf21c 100644
--- a/bookkeeper-stats/pom.xml
+++ b/bookkeeper-stats/pom.xml
@@ -55,9 +55,5 @@
     </plugins>
   </build>
   <dependencies>
-    <dependency>
-      <groupId>commons-configuration</groupId>
-      <artifactId>commons-configuration</artifactId>
-    </dependency>
   </dependencies>
 </project>
diff --git a/circe-checksum/build.gradle b/circe-checksum/build.gradle
index dca984be7..12d9f5f73 100644
--- a/circe-checksum/build.gradle
+++ b/circe-checksum/build.gradle
@@ -25,6 +25,9 @@ dependencies {
     implementation depLibs.guava
     implementation depLibs.nettyBuffer
     implementation depLibs.slf4j
+
+    testImplementation project(':testtools')
+
     testImplementation depLibs.junit
     testImplementation depLibs.mockito
 }
diff --git a/circe-checksum/pom.xml b/circe-checksum/pom.xml
index 6f986e1fe..dd76177f5 100644
--- a/circe-checksum/pom.xml
+++ b/circe-checksum/pom.xml
@@ -50,6 +50,12 @@
       <artifactId>netty-buffer</artifactId>
     </dependency>
 
+    <dependency>
+      <groupId>org.apache.bookkeeper</groupId>
+      <artifactId>testtools</artifactId>
+      <version>${project.parent.version}</version>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
   <build>
diff --git a/circe-checksum/src/test/resources/log4j.properties b/circe-checksum/src/test/resources/log4j.properties
deleted file mode 100644
index 10ae6bfcb..000000000
--- a/circe-checksum/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,42 +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.
-#
-#
-
-#
-# Bookkeeper Logging Configuration
-#
-
-# Format is "<default threshold> (, <appender>)+
-
-# DEFAULT: console appender only, level INFO
-bookkeeper.root.logger=INFO,CONSOLE
-log4j.rootLogger=${bookkeeper.root.logger}
-
-#
-# Log INFO level and above messages to the console
-#
-log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
-log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
-log4j.appender.CONSOLE.layout.ConversionPattern=%d{ISO8601} - %-5p - [%t:%C{1}@%L] - %m%n
-
-#disable zookeeper logging
-log4j.logger.org.apache.zookeeper=OFF
-log4j.logger.org.apache.bookkeeper.bookie=INFO
-log4j.logger.org.apache.bookkeeper.meta=INFO
diff --git a/dependencies.gradle b/dependencies.gradle
index c68c0ed61..e96c42909 100644
--- a/dependencies.gradle
+++ b/dependencies.gradle
@@ -82,7 +82,7 @@ depVersions = [
     spotbugsAnnotations: "3.1.8",
     protocGenGrpcJava: "1.12.0",
     shrinkwrap:"3.1.4",
-    snappy: "1.1.7",
+    snappy: "1.1.7.7",
     thrift: "0.14.2",
     testcontainers: "1.16.3",
     vertx: "3.9.8",
diff --git a/metadata-drivers/etcd/build.gradle b/metadata-drivers/etcd/build.gradle
index 7ab755948..0004b783c 100644
--- a/metadata-drivers/etcd/build.gradle
+++ b/metadata-drivers/etcd/build.gradle
@@ -36,6 +36,7 @@ dependencies {
     testImplementation depLibs.arquillianCubeDocker
     testImplementation depLibs.arquillianJunitStandalone
     testImplementation depLibs.testcontainers
+    testImplementation project(':testtools')
     testImplementation project(path: ':bookkeeper-common', configuration: 'testArtifacts')
     testImplementation project(path: ':bookkeeper-server', configuration: 'testArtifacts')
     testImplementation depLibs.dockerJava
diff --git a/metadata-drivers/etcd/pom.xml b/metadata-drivers/etcd/pom.xml
index c90720060..1a769c1ed 100644
--- a/metadata-drivers/etcd/pom.xml
+++ b/metadata-drivers/etcd/pom.xml
@@ -90,6 +90,12 @@
       <artifactId>testcontainers</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.bookkeeper</groupId>
+      <artifactId>testtools</artifactId>
+      <version>${project.parent.version}</version>
+      <scope>test</scope>
+    </dependency>
     <dependency>
       <groupId>org.apache.bookkeeper</groupId>
       <artifactId>bookkeeper-common</artifactId>
diff --git a/metadata-drivers/etcd/src/test/resources/log4j.properties b/metadata-drivers/etcd/src/test/resources/log4j.properties
deleted file mode 100644
index e6e9f7837..000000000
--- a/metadata-drivers/etcd/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,39 +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.
-#
-
-#
-# Bookkeeper Logging Configuration
-#
-
-# Format is "<default threshold> (, <appender>)+
-
-# DEFAULT: console appender only, level INFO
-bookkeeper.root.logger=INFO,CONSOLE
-log4j.rootLogger=${bookkeeper.root.logger}
-
-#
-# Log INFO level and above messages to the console
-#
-log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
-log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
-log4j.appender.CONSOLE.layout.ConversionPattern=%d{ISO8601} - %-5p - [%t:%C{1}@%L] - %m%n
-
-#disable zookeeper logging
-log4j.logger.org.apache.zookeeper=OFF
-log4j.logger.org.apache.bookkeeper.bookie=INFO
-log4j.logger.org.apache.bookkeeper.meta=INFO
diff --git a/microbenchmarks/pom.xml b/microbenchmarks/pom.xml
index 297f37aab..746421cfc 100644
--- a/microbenchmarks/pom.xml
+++ b/microbenchmarks/pom.xml
@@ -38,10 +38,6 @@
       <artifactId>jmh-generator-annprocess</artifactId>
       <scope>provided</scope>
     </dependency>
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-api</artifactId>
-    </dependency>
     <dependency>
       <groupId>org.apache.logging.log4j</groupId>
       <artifactId>log4j-1.2-api</artifactId>
diff --git a/pom.xml b/pom.xml
index b2e6f9606..dfcbaf29c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -73,6 +73,7 @@
     <module>bookkeeper-slogger</module>
     <module>tests</module>
     <module>native-io</module>
+    <module>testtools</module>
   </modules>
   <mailingLists>
     <mailingList>
@@ -176,7 +177,7 @@
     <testcontainers.version>1.15.1</testcontainers.version>
     <vertx.version>3.9.8</vertx.version>
     <zookeeper.version>3.8.0</zookeeper.version>
-    <snappy.version>1.1.7</snappy.version>
+    <snappy.version>1.1.7.7</snappy.version>
     <jctools.version>2.1.2</jctools.version>
     <!-- plugin dependencies -->
     <apache-rat-plugin.version>0.12</apache-rat-plugin.version>
@@ -1219,9 +1220,19 @@
       </activation>
       <properties>
         <test.additional.args>
-          --add-opens java.base/jdk.internal.loader=ALL-UNNAMED
-          --add-opens java.base/java.lang=ALL-UNNAMED
           --add-opens java.base/java.io=ALL-UNNAMED
+          --add-opens java.base/java.lang=ALL-UNNAMED
+          --add-opens java.base/java.nio=ALL-UNNAMED
+          --add-opens java.base/java.nio.channels.spi=ALL-UNNAMED
+          --add-opens java.base/java.util=ALL-UNNAMED
+          --add-opens java.base/java.util.concurrent=ALL-UNNAMED
+          --add-opens java.base/java.util.stream=ALL-UNNAMED
+          --add-opens java.base/java.time=ALL-UNNAMED
+          --add-opens java.base/jdk.internal.loader=ALL-UNNAMED
+          --add-opens java.base/sun.net.dns=ALL-UNNAMED
+          --add-opens java.base/sun.nio.ch=ALL-UNNAMED
+          --add-opens java.base/sun.security.jca=ALL-UNNAMED
+          --add-opens java.xml/jdk.xml.internal=ALL-UNNAMED
         </test.additional.args>
       </properties>
     </profile>
diff --git a/settings.gradle b/settings.gradle
index 550476e3f..1483afef5 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -99,7 +99,9 @@ include(':bookkeeper-benchmark',
         'tests:scripts',
         'tests:shaded:bookkeeper-server-shaded-test',
         'tests:shaded:bookkeeper-server-tests-shaded-test',
-        'tests:shaded:distributedlog-core-shaded-test')
+        'tests:shaded:distributedlog-core-shaded-test',
+        'testtools',
+)
 
 project(':bookkeeper-tools').projectDir = file('tools/all')
 project(':bookkeeper-tools-framework').projectDir = file('tools/framework')
diff --git a/stream/clients/java/all/build.gradle b/stream/clients/java/all/build.gradle
index a3a2ea3e5..84ff33ad5 100644
--- a/stream/clients/java/all/build.gradle
+++ b/stream/clients/java/all/build.gradle
@@ -30,6 +30,7 @@ dependencies {
     compileOnly depLibs.lombok
     implementation depLibs.slf4j
 
+    testImplementation project(':testtools')
     testImplementation project(path: ':stream:clients:java:base', configuration: 'testArtifacts')
     testImplementation depLibs.mockito
     testImplementation depLibs.powermockJunit
diff --git a/stream/clients/java/all/pom.xml b/stream/clients/java/all/pom.xml
index 489288582..0130d73bd 100644
--- a/stream/clients/java/all/pom.xml
+++ b/stream/clients/java/all/pom.xml
@@ -31,6 +31,12 @@
       <artifactId>stream-storage-java-kv-client</artifactId>
       <version>${project.parent.version}</version>
     </dependency>
+    <dependency>
+      <groupId>org.apache.bookkeeper</groupId>
+      <artifactId>testtools</artifactId>
+      <version>${project.parent.version}</version>
+      <scope>test</scope>
+    </dependency>
     <dependency>
       <groupId>org.apache.bookkeeper</groupId>
       <artifactId>stream-storage-java-client-base</artifactId>
diff --git a/stream/clients/java/all/src/test/resources/log4j.properties b/stream/clients/java/all/src/test/resources/log4j.properties
deleted file mode 100644
index e651cb4b6..000000000
--- a/stream/clients/java/all/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,53 +0,0 @@
-#/**
-# * Copyright 2007 The Apache Software Foundation
-# *
-# * 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.
-# */
-
-#
-# DisributedLog Logging Configuration
-#
-
-# Example with rolling log file
-log4j.rootLogger=INFO, CONSOLE
-
-#disable zookeeper logging
-log4j.logger.org.apache.zookeeper=OFF
-#Set the bookkeeper level to warning
-log4j.logger.org.apache.bookkeeper=INFO
-
-log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
-log4j.appender.CONSOLE.Threshold=INFO
-log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
-log4j.appender.CONSOLE.layout.ConversionPattern=%d{ISO8601} - %-5p - [%t:%C{1}@%L] - %m%n
-
-# Add ROLLINGFILE to rootLogger to get log file output
-#    Log DEBUG level and above messages to a log file
-#log4j.appender.ROLLINGFILE=org.apache.log4j.DailyRollingFileAppender
-#log4j.appender.ROLLINGFILE.Threshold=INFO
-#log4j.appender.ROLLINGFILE.File=zstream.log
-#log4j.appender.ROLLINGFILE.layout=org.apache.log4j.PatternLayout
-#log4j.appender.ROLLINGFILE.DatePattern='.'yyyy-MM-dd-HH-mm
-#log4j.appender.ROLLINGFILE.layout.ConversionPattern=%d{ISO8601} - %-5p - [%t:%C{1}@%L] - %m%n
-
-log4j.appender.R=org.apache.log4j.RollingFileAppender
-log4j.appender.R.Threshold=TRACE
-log4j.appender.R.File=target/error.log
-log4j.appender.R.MaxFileSize=200MB
-log4j.appender.R.MaxBackupIndex=7
-log4j.appender.R.layout=org.apache.log4j.PatternLayout
-log4j.appender.R.layout.ConversionPattern=%d{ISO8601} - %-5p - [%t:%C{1}@%L] - %m%n
diff --git a/stream/clients/java/base/build.gradle b/stream/clients/java/base/build.gradle
index a855902b7..065908467 100644
--- a/stream/clients/java/base/build.gradle
+++ b/stream/clients/java/base/build.gradle
@@ -31,6 +31,8 @@ dependencies {
     compileOnly depLibs.lombok
     implementation depLibs.slf4j
 
+    testImplementation project(':testtools')
+
     testImplementation depLibs.mockito
 
     testImplementation depLibs.freebuilder
diff --git a/stream/clients/java/base/pom.xml b/stream/clients/java/base/pom.xml
index ac4c9e4ed..e7b2eefed 100644
--- a/stream/clients/java/base/pom.xml
+++ b/stream/clients/java/base/pom.xml
@@ -36,6 +36,12 @@
       <artifactId>stream-storage-proto</artifactId>
       <version>${project.parent.version}</version>
     </dependency>
+    <dependency>
+      <groupId>org.apache.bookkeeper</groupId>
+      <artifactId>testtools</artifactId>
+      <version>${project.parent.version}</version>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
   <build>
     <plugins>
diff --git a/stream/clients/java/base/src/test/resources/log4j.properties b/stream/clients/java/base/src/test/resources/log4j.properties
deleted file mode 100644
index 9405038b2..000000000
--- a/stream/clients/java/base/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,51 +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.
-#
-
-#
-# DisributedLog Logging Configuration
-#
-
-# Example with rolling log file
-log4j.rootLogger=INFO, CONSOLE
-
-#disable zookeeper logging
-log4j.logger.org.apache.zookeeper=OFF
-#Set the bookkeeper level to warning
-log4j.logger.org.apache.bookkeeper=INFO
-
-log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
-log4j.appender.CONSOLE.Threshold=INFO
-log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
-log4j.appender.CONSOLE.layout.ConversionPattern=%d{ISO8601} - %-5p - [%t:%C{1}@%L] - %m%n
-
-# Add ROLLINGFILE to rootLogger to get log file output
-#    Log DEBUG level and above messages to a log file
-#log4j.appender.ROLLINGFILE=org.apache.log4j.DailyRollingFileAppender
-#log4j.appender.ROLLINGFILE.Threshold=INFO
-#log4j.appender.ROLLINGFILE.File=stream.log
-#log4j.appender.ROLLINGFILE.layout=org.apache.log4j.PatternLayout
-#log4j.appender.ROLLINGFILE.DatePattern='.'yyyy-MM-dd-HH-mm
-#log4j.appender.ROLLINGFILE.layout.ConversionPattern=%d{ISO8601} - %-5p - [%t:%C{1}@%L] - %m%n
-
-log4j.appender.R=org.apache.log4j.RollingFileAppender
-log4j.appender.R.Threshold=TRACE
-log4j.appender.R.File=target/error.log
-log4j.appender.R.MaxFileSize=200MB
-log4j.appender.R.MaxBackupIndex=7
-log4j.appender.R.layout=org.apache.log4j.PatternLayout
-log4j.appender.R.layout.ConversionPattern=%d{ISO8601} - %-5p - [%t:%C{1}@%L] - %m%n
diff --git a/stream/clients/java/kv/build.gradle b/stream/clients/java/kv/build.gradle
index 3df6167cd..de85b5ba7 100644
--- a/stream/clients/java/kv/build.gradle
+++ b/stream/clients/java/kv/build.gradle
@@ -30,6 +30,7 @@ dependencies {
     implementation depLibs.protobuf
     implementation depLibs.slf4j
     compileOnly depLibs.jsr305
+    testImplementation project(':testtools')
     testImplementation project(path: ':stream:clients:java:base', configuration: 'testArtifacts')
     testImplementation depLibs.mockito
     testImplementation depLibs.junit
diff --git a/stream/clients/java/kv/pom.xml b/stream/clients/java/kv/pom.xml
index 7c2ebbb75..16aa9463a 100644
--- a/stream/clients/java/kv/pom.xml
+++ b/stream/clients/java/kv/pom.xml
@@ -31,6 +31,12 @@
       <artifactId>stream-storage-java-client-base</artifactId>
       <version>${project.parent.version}</version>
     </dependency>
+    <dependency>
+      <groupId>org.apache.bookkeeper</groupId>
+      <artifactId>testtools</artifactId>
+      <version>${project.parent.version}</version>
+      <scope>test</scope>
+    </dependency>
     <dependency>
       <groupId>org.apache.bookkeeper</groupId>
       <artifactId>stream-storage-java-client-base</artifactId>
diff --git a/stream/clients/java/kv/src/test/resources/log4j.properties b/stream/clients/java/kv/src/test/resources/log4j.properties
deleted file mode 100644
index 9405038b2..000000000
--- a/stream/clients/java/kv/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,51 +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.
-#
-
-#
-# DisributedLog Logging Configuration
-#
-
-# Example with rolling log file
-log4j.rootLogger=INFO, CONSOLE
-
-#disable zookeeper logging
-log4j.logger.org.apache.zookeeper=OFF
-#Set the bookkeeper level to warning
-log4j.logger.org.apache.bookkeeper=INFO
-
-log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
-log4j.appender.CONSOLE.Threshold=INFO
-log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
-log4j.appender.CONSOLE.layout.ConversionPattern=%d{ISO8601} - %-5p - [%t:%C{1}@%L] - %m%n
-
-# Add ROLLINGFILE to rootLogger to get log file output
-#    Log DEBUG level and above messages to a log file
-#log4j.appender.ROLLINGFILE=org.apache.log4j.DailyRollingFileAppender
-#log4j.appender.ROLLINGFILE.Threshold=INFO
-#log4j.appender.ROLLINGFILE.File=stream.log
-#log4j.appender.ROLLINGFILE.layout=org.apache.log4j.PatternLayout
-#log4j.appender.ROLLINGFILE.DatePattern='.'yyyy-MM-dd-HH-mm
-#log4j.appender.ROLLINGFILE.layout.ConversionPattern=%d{ISO8601} - %-5p - [%t:%C{1}@%L] - %m%n
-
-log4j.appender.R=org.apache.log4j.RollingFileAppender
-log4j.appender.R.Threshold=TRACE
-log4j.appender.R.File=target/error.log
-log4j.appender.R.MaxFileSize=200MB
-log4j.appender.R.MaxBackupIndex=7
-log4j.appender.R.layout=org.apache.log4j.PatternLayout
-log4j.appender.R.layout.ConversionPattern=%d{ISO8601} - %-5p - [%t:%C{1}@%L] - %m%n
diff --git a/stream/distributedlog/core/build.gradle b/stream/distributedlog/core/build.gradle
index ee9a79fc1..2af471ac7 100644
--- a/stream/distributedlog/core/build.gradle
+++ b/stream/distributedlog/core/build.gradle
@@ -46,6 +46,7 @@ dependencies {
     testRuntimeOnly depLibs.metricsCore
     testRuntimeOnly depLibs.snappy
 
+    testImplementation project(':testtools')
     testImplementation project(path: ':bookkeeper-common', configuration: 'testArtifacts')
     testImplementation project(path: ':bookkeeper-server', configuration: 'testArtifacts')
     testImplementation project(path: ':stream:distributedlog:common', configuration: 'testArtifacts')
diff --git a/stream/distributedlog/core/pom.xml b/stream/distributedlog/core/pom.xml
index 67ef4b422..67caafa14 100644
--- a/stream/distributedlog/core/pom.xml
+++ b/stream/distributedlog/core/pom.xml
@@ -49,6 +49,12 @@
       <!-- this should not be bundled in binary distributions -->
       <optional>true</optional>
     </dependency>
+    <dependency>
+      <groupId>org.apache.bookkeeper</groupId>
+      <artifactId>testtools</artifactId>
+      <version>${project.parent.version}</version>
+      <scope>test</scope>
+    </dependency>
     <dependency>
       <groupId>org.jmock</groupId>
       <artifactId>jmock</artifactId>
diff --git a/stream/distributedlog/core/src/test/resources/log4j.properties b/stream/distributedlog/core/src/test/resources/log4j.properties
deleted file mode 100644
index 3e5105936..000000000
--- a/stream/distributedlog/core/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,51 +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.
-# */
-
-#
-# DisributedLog Logging Configuration
-#
-
-# Example with rolling log file
-log4j.rootLogger=INFO, CONSOLE
-
-#disable zookeeper logging
-log4j.logger.org.apache.zookeeper=OFF
-#Set the bookkeeper level to warning
-log4j.logger.org.apache.bookkeeper=INFO
-
-log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
-log4j.appender.CONSOLE.Threshold=INFO
-log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
-log4j.appender.CONSOLE.layout.ConversionPattern=%d{ISO8601} - %-5p - [%t:%C{1}@%L] - %m%n
-
-# Add ROLLINGFILE to rootLogger to get log file output
-#    Log DEBUG level and above messages to a log file
-#log4j.appender.ROLLINGFILE=org.apache.log4j.DailyRollingFileAppender
-#log4j.appender.ROLLINGFILE.Threshold=INFO
-#log4j.appender.ROLLINGFILE.File=distributedlog.log
-#log4j.appender.ROLLINGFILE.layout=org.apache.log4j.PatternLayout
-#log4j.appender.ROLLINGFILE.DatePattern='.'yyyy-MM-dd-HH-mm
-#log4j.appender.ROLLINGFILE.layout.ConversionPattern=%d{ISO8601} - %-5p - [%t:%C{1}@%L] - %m%n
-
-log4j.appender.R=org.apache.log4j.RollingFileAppender
-log4j.appender.R.Threshold=TRACE
-log4j.appender.R.File=target/error.log
-log4j.appender.R.MaxFileSize=200MB
-log4j.appender.R.MaxBackupIndex=7
-log4j.appender.R.layout=org.apache.log4j.PatternLayout
-log4j.appender.R.layout.ConversionPattern=%d{ISO8601} - %-5p - [%t:%C{1}@%L] - %m%n
diff --git a/stream/distributedlog/protocol/build.gradle b/stream/distributedlog/protocol/build.gradle
index 532d41fb8..869a4e611 100644
--- a/stream/distributedlog/protocol/build.gradle
+++ b/stream/distributedlog/protocol/build.gradle
@@ -32,6 +32,7 @@ dependencies {
     implementation depLibs.slf4j
 
     testImplementation project(':bookkeeper-common')
+    testImplementation project(':testtools')
     testImplementation depLibs.junit
     testImplementation depLibs.lombok
     annotationProcessor depLibs.lombok
diff --git a/stream/distributedlog/protocol/pom.xml b/stream/distributedlog/protocol/pom.xml
index 7a1748ab7..cd29b40f6 100644
--- a/stream/distributedlog/protocol/pom.xml
+++ b/stream/distributedlog/protocol/pom.xml
@@ -34,6 +34,12 @@
       <groupId>io.netty</groupId>
       <artifactId>netty-buffer</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.apache.bookkeeper</groupId>
+      <artifactId>testtools</artifactId>
+      <version>${project.parent.version}</version>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
   <build>
     <plugins>
diff --git a/stream/distributedlog/protocol/src/test/resources/log4j.properties b/stream/distributedlog/protocol/src/test/resources/log4j.properties
deleted file mode 100644
index 3e5105936..000000000
--- a/stream/distributedlog/protocol/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,51 +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.
-# */
-
-#
-# DisributedLog Logging Configuration
-#
-
-# Example with rolling log file
-log4j.rootLogger=INFO, CONSOLE
-
-#disable zookeeper logging
-log4j.logger.org.apache.zookeeper=OFF
-#Set the bookkeeper level to warning
-log4j.logger.org.apache.bookkeeper=INFO
-
-log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
-log4j.appender.CONSOLE.Threshold=INFO
-log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
-log4j.appender.CONSOLE.layout.ConversionPattern=%d{ISO8601} - %-5p - [%t:%C{1}@%L] - %m%n
-
-# Add ROLLINGFILE to rootLogger to get log file output
-#    Log DEBUG level and above messages to a log file
-#log4j.appender.ROLLINGFILE=org.apache.log4j.DailyRollingFileAppender
-#log4j.appender.ROLLINGFILE.Threshold=INFO
-#log4j.appender.ROLLINGFILE.File=distributedlog.log
-#log4j.appender.ROLLINGFILE.layout=org.apache.log4j.PatternLayout
-#log4j.appender.ROLLINGFILE.DatePattern='.'yyyy-MM-dd-HH-mm
-#log4j.appender.ROLLINGFILE.layout.ConversionPattern=%d{ISO8601} - %-5p - [%t:%C{1}@%L] - %m%n
-
-log4j.appender.R=org.apache.log4j.RollingFileAppender
-log4j.appender.R.Threshold=TRACE
-log4j.appender.R.File=target/error.log
-log4j.appender.R.MaxFileSize=200MB
-log4j.appender.R.MaxBackupIndex=7
-log4j.appender.R.layout=org.apache.log4j.PatternLayout
-log4j.appender.R.layout.ConversionPattern=%d{ISO8601} - %-5p - [%t:%C{1}@%L] - %m%n
diff --git a/stream/proto/build.gradle b/stream/proto/build.gradle
index 8a16bf524..0bb88331b 100644
--- a/stream/proto/build.gradle
+++ b/stream/proto/build.gradle
@@ -33,6 +33,8 @@ dependencies {
     testImplementation depLibs.junit
     compileOnly depLibs.javaAnnotations
     annotationProcessor depLibs.lombok
+
+    testImplementation project(':testtools')
 }
 
 protobuf {
diff --git a/stream/proto/pom.xml b/stream/proto/pom.xml
index 570407359..bd60d3de1 100644
--- a/stream/proto/pom.xml
+++ b/stream/proto/pom.xml
@@ -47,6 +47,12 @@
       <!-- this should not be bundled in binary distributions -->
       <optional>true</optional>
     </dependency>
+    <dependency>
+      <groupId>org.apache.bookkeeper</groupId>
+      <artifactId>testtools</artifactId>
+      <version>${project.parent.version}</version>
+      <scope>test</scope>
+    </dependency>
     <dependency>
       <groupId>org.apache.bookkeeper.tests</groupId>
       <artifactId>stream-storage-tests-common</artifactId>
diff --git a/stream/proto/src/test/resources/log4j.properties b/stream/proto/src/test/resources/log4j.properties
deleted file mode 100644
index e651cb4b6..000000000
--- a/stream/proto/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,53 +0,0 @@
-#/**
-# * Copyright 2007 The Apache Software Foundation
-# *
-# * 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.
-# */
-
-#
-# DisributedLog Logging Configuration
-#
-
-# Example with rolling log file
-log4j.rootLogger=INFO, CONSOLE
-
-#disable zookeeper logging
-log4j.logger.org.apache.zookeeper=OFF
-#Set the bookkeeper level to warning
-log4j.logger.org.apache.bookkeeper=INFO
-
-log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
-log4j.appender.CONSOLE.Threshold=INFO
-log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
-log4j.appender.CONSOLE.layout.ConversionPattern=%d{ISO8601} - %-5p - [%t:%C{1}@%L] - %m%n
-
-# Add ROLLINGFILE to rootLogger to get log file output
-#    Log DEBUG level and above messages to a log file
-#log4j.appender.ROLLINGFILE=org.apache.log4j.DailyRollingFileAppender
-#log4j.appender.ROLLINGFILE.Threshold=INFO
-#log4j.appender.ROLLINGFILE.File=zstream.log
-#log4j.appender.ROLLINGFILE.layout=org.apache.log4j.PatternLayout
-#log4j.appender.ROLLINGFILE.DatePattern='.'yyyy-MM-dd-HH-mm
-#log4j.appender.ROLLINGFILE.layout.ConversionPattern=%d{ISO8601} - %-5p - [%t:%C{1}@%L] - %m%n
-
-log4j.appender.R=org.apache.log4j.RollingFileAppender
-log4j.appender.R.Threshold=TRACE
-log4j.appender.R.File=target/error.log
-log4j.appender.R.MaxFileSize=200MB
-log4j.appender.R.MaxBackupIndex=7
-log4j.appender.R.layout=org.apache.log4j.PatternLayout
-log4j.appender.R.layout.ConversionPattern=%d{ISO8601} - %-5p - [%t:%C{1}@%L] - %m%n
diff --git a/stream/server/build.gradle b/stream/server/build.gradle
index 19faa1896..edf934347 100644
--- a/stream/server/build.gradle
+++ b/stream/server/build.gradle
@@ -68,6 +68,8 @@ dependencies {
     compileOnly depLibs.javaAnnotations
 
     annotationProcessor depLibs.lombok
+
+    testImplementation project(':testtools')
 }
 
 application {
diff --git a/stream/server/pom.xml b/stream/server/pom.xml
index 8889856cb..3fc2255ee 100644
--- a/stream/server/pom.xml
+++ b/stream/server/pom.xml
@@ -58,6 +58,12 @@
        <artifactId>metrics-core</artifactId>
        <scope>runtime</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.bookkeeper</groupId>
+      <artifactId>testtools</artifactId>
+      <version>${project.parent.version}</version>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
   <build>
diff --git a/stream/server/src/test/resources/log4j.properties b/stream/server/src/test/resources/log4j.properties
deleted file mode 100644
index 453e6e0e0..000000000
--- a/stream/server/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,53 +0,0 @@
-#/**
-# * Copyright 2007 The Apache Software Foundation
-# *
-# * 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.
-# */
-
-#
-# DisributedLog Logging Configuration
-#
-
-# Example with rolling log file
-log4j.rootLogger=INFO, CONSOLE
-
-#disable zookeeper logging
-log4j.logger.org.apache.zookeeper=OFF
-#Set the bookkeeper level to warning
-log4j.logger.org.apache.bookkeeper=INFO
-
-log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
-log4j.appender.CONSOLE.Threshold=INFO
-log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
-log4j.appender.CONSOLE.layout.ConversionPattern=%d{ISO8601} - %-5p - [%t:%C{1}@%L] - %m%n
-
-# Add ROLLINGFILE to rootLogger to get log file output
-#    Log DEBUG level and above messages to a log file
-#log4j.appender.ROLLINGFILE=org.apache.log4j.DailyRollingFileAppender
-#log4j.appender.ROLLINGFILE.Threshold=INFO
-#log4j.appender.ROLLINGFILE.File=stream.log
-#log4j.appender.ROLLINGFILE.layout=org.apache.log4j.PatternLayout
-#log4j.appender.ROLLINGFILE.DatePattern='.'yyyy-MM-dd-HH-mm
-#log4j.appender.ROLLINGFILE.layout.ConversionPattern=%d{ISO8601} - %-5p - [%t:%C{1}@%L] - %m%n
-
-log4j.appender.R=org.apache.log4j.RollingFileAppender
-log4j.appender.R.Threshold=TRACE
-log4j.appender.R.File=target/error.log
-log4j.appender.R.MaxFileSize=200MB
-log4j.appender.R.MaxBackupIndex=7
-log4j.appender.R.layout=org.apache.log4j.PatternLayout
-log4j.appender.R.layout.ConversionPattern=%d{ISO8601} - %-5p - [%t:%C{1}@%L] - %m%n
diff --git a/stream/statelib/build.gradle b/stream/statelib/build.gradle
index 754f53e03..0ecf8e7cf 100644
--- a/stream/statelib/build.gradle
+++ b/stream/statelib/build.gradle
@@ -43,6 +43,7 @@ dependencies {
     implementation depLibs.rocksDb
     implementation depLibs.slf4j
 
+    testImplementation project(':testtools')
     testImplementation depLibs.commonsConfiguration
     testImplementation depLibs.commonsIO
     testImplementation depLibs.junit
diff --git a/stream/statelib/pom.xml b/stream/statelib/pom.xml
index 871ab65c1..23996e66e 100644
--- a/stream/statelib/pom.xml
+++ b/stream/statelib/pom.xml
@@ -97,6 +97,12 @@
       <version>${dropwizard.version}</version>
     </dependency>
 
+    <dependency>
+      <groupId>org.apache.bookkeeper</groupId>
+      <artifactId>testtools</artifactId>
+      <version>${project.parent.version}</version>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
   <build>
     <extensions>
diff --git a/stream/statelib/src/test/resources/log4j.properties b/stream/statelib/src/test/resources/log4j.properties
deleted file mode 100644
index 9f4666a2f..000000000
--- a/stream/statelib/src/test/resources/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.
-# */
-
-#
-# DisributedLog Logging Configuration
-#
-
-dlog.test.logger=INFO, CONSOLE
-log4j.rootLogger=${dlog.test.logger}
-
-#disable zookeeper logging
-log4j.logger.org.apache.zookeeper=OFF
-#Set the bookkeeper level to warning
-log4j.logger.org.apache.bookkeeper=INFO
-
-log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
-log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
-log4j.appender.CONSOLE.layout.ConversionPattern=%d{ISO8601} - %-5p - [%t:%C{1}@%L] - %m%n
diff --git a/stream/storage/impl/build.gradle b/stream/storage/impl/build.gradle
index 0e00a3e5b..05fee0b4b 100644
--- a/stream/storage/impl/build.gradle
+++ b/stream/storage/impl/build.gradle
@@ -47,6 +47,7 @@ dependencies {
     compileOnly depLibs.jsr305
     testImplementation project(':stream:distributedlog:common')
     testImplementation project(':stream:distributedlog:protocol')
+    testImplementation project(':testtools')
     testImplementation project(path: ':bookkeeper-common', configuration: 'testArtifacts')
     testImplementation project(path: ':stream:clients:java:base', configuration: 'testArtifacts')
     testImplementation project(path: ':stream:distributedlog:core', configuration: 'testArtifacts')
diff --git a/stream/storage/impl/pom.xml b/stream/storage/impl/pom.xml
index 961f5b1a1..c683eecf2 100644
--- a/stream/storage/impl/pom.xml
+++ b/stream/storage/impl/pom.xml
@@ -46,6 +46,12 @@
       <groupId>org.apache.curator</groupId>
       <artifactId>curator-recipes</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.apache.bookkeeper</groupId>
+      <artifactId>testtools</artifactId>
+      <version>${project.parent.version}</version>
+      <scope>test</scope>
+    </dependency>
     <dependency>
       <groupId>org.apache.distributedlog</groupId>
       <artifactId>distributedlog-core</artifactId>
diff --git a/stream/storage/impl/src/test/resources/log4j.properties b/stream/storage/impl/src/test/resources/log4j.properties
deleted file mode 100644
index e651cb4b6..000000000
--- a/stream/storage/impl/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,53 +0,0 @@
-#/**
-# * Copyright 2007 The Apache Software Foundation
-# *
-# * 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.
-# */
-
-#
-# DisributedLog Logging Configuration
-#
-
-# Example with rolling log file
-log4j.rootLogger=INFO, CONSOLE
-
-#disable zookeeper logging
-log4j.logger.org.apache.zookeeper=OFF
-#Set the bookkeeper level to warning
-log4j.logger.org.apache.bookkeeper=INFO
-
-log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
-log4j.appender.CONSOLE.Threshold=INFO
-log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
-log4j.appender.CONSOLE.layout.ConversionPattern=%d{ISO8601} - %-5p - [%t:%C{1}@%L] - %m%n
-
-# Add ROLLINGFILE to rootLogger to get log file output
-#    Log DEBUG level and above messages to a log file
-#log4j.appender.ROLLINGFILE=org.apache.log4j.DailyRollingFileAppender
-#log4j.appender.ROLLINGFILE.Threshold=INFO
-#log4j.appender.ROLLINGFILE.File=zstream.log
-#log4j.appender.ROLLINGFILE.layout=org.apache.log4j.PatternLayout
-#log4j.appender.ROLLINGFILE.DatePattern='.'yyyy-MM-dd-HH-mm
-#log4j.appender.ROLLINGFILE.layout.ConversionPattern=%d{ISO8601} - %-5p - [%t:%C{1}@%L] - %m%n
-
-log4j.appender.R=org.apache.log4j.RollingFileAppender
-log4j.appender.R.Threshold=TRACE
-log4j.appender.R.File=target/error.log
-log4j.appender.R.MaxFileSize=200MB
-log4j.appender.R.MaxBackupIndex=7
-log4j.appender.R.layout=org.apache.log4j.PatternLayout
-log4j.appender.R.layout.ConversionPattern=%d{ISO8601} - %-5p - [%t:%C{1}@%L] - %m%n
diff --git a/tests/integration-tests-base/pom.xml b/tests/integration-tests-base/pom.xml
index 733bc3f69..bb41e64cc 100644
--- a/tests/integration-tests-base/pom.xml
+++ b/tests/integration-tests-base/pom.xml
@@ -49,12 +49,6 @@
       <scope>test</scope>
     </dependency>
 
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <scope>test</scope>
-    </dependency>
-
   </dependencies>
 
   <build>
diff --git a/tests/integration-tests-utils/src/main/resources/log4j.properties b/tests/integration-tests-utils/src/main/resources/log4j.properties
deleted file mode 100644
index 09ac2e75d..000000000
--- a/tests/integration-tests-utils/src/main/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.
-#
-#
-
-# Format is "<default threshold> (, <appender>)+
-
-# DEFAULT: console appender only, level INFO
-log4j.rootLogger=INFO,CONSOLE
-
-#
-# Log INFO level and above messages to the console
-#
-log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
-log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
-log4j.appender.CONSOLE.layout.ConversionPattern=%d{ISO8601} - %-5p - [%t:%C{1}@%L] - %m%n
-
-#disable zookeeper logging
-log4j.logger.org.apache.zookeeper=OFF
-log4j.logger.org.apache.bookkeeper.bookie=INFO
-log4j.logger.org.apache.bookkeeper.meta=INFO
diff --git a/metadata-drivers/etcd/src/test/resources/log4j2.xml b/tests/integration-tests-utils/src/main/resources/log4j2.xml
similarity index 81%
copy from metadata-drivers/etcd/src/test/resources/log4j2.xml
copy to tests/integration-tests-utils/src/main/resources/log4j2.xml
index 184f58487..12f713a7b 100644
--- a/metadata-drivers/etcd/src/test/resources/log4j2.xml
+++ b/tests/integration-tests-utils/src/main/resources/log4j2.xml
@@ -1,6 +1,5 @@
 <?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
@@ -8,31 +7,24 @@
     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 status="INFO">
     <Appenders>
         <Console name="Console" target="SYSTEM_OUT">
-            <PatternLayout pattern="%d{ISO8601_OFFSET_DATE_TIME_HHMM} %-5level [%t{12}] %c{1.}@%L - %msg %X%n" />
+            <PatternLayout pattern="%d{ISO8601_OFFSET_DATE_TIME_HHMM} %-5level [%t{12}] %c{1.}@%L - %msg%n" />
         </Console>
     </Appenders>
     <Loggers>
         <Root level="warn">
             <AppenderRef ref="Console" />
         </Root>
-        <Logger name="org.eclipse.jetty" level="info"/>
-        <Logger name="org.apache.pulsar" level="info"/>
         <Logger name="org.apache.bookkeeper" level="info"/>
-        <Logger name="org.apache.kafka" level="info"/>
-        <Logger name="org.testcontainers" level="info"/>
     </Loggers>
 </Configuration>
diff --git a/tests/integration/cluster/build.gradle b/tests/integration/cluster/build.gradle
index 71a01ac38..a8acf5261 100644
--- a/tests/integration/cluster/build.gradle
+++ b/tests/integration/cluster/build.gradle
@@ -36,6 +36,7 @@ dependencies {
     testImplementation project(':bookkeeper-stats')
     testImplementation project(':tests:integration-tests-topologies')
     testImplementation project(':stream:clients:java:kv')
+    testImplementation project(':testtools')
 
     testCompileOnly depLibs.lombok
     testImplementation depLibs.log4j12api
diff --git a/tests/integration/cluster/pom.xml b/tests/integration/cluster/pom.xml
index 97e7a9ce2..af5586588 100644
--- a/tests/integration/cluster/pom.xml
+++ b/tests/integration/cluster/pom.xml
@@ -31,6 +31,13 @@
   <name>Apache BookKeeper :: Tests :: Integration :: Cluster test</name>
 
   <dependencies>
+    <dependency>
+      <groupId>org.apache.bookkeeper</groupId>
+      <artifactId>testtools</artifactId>
+      <version>${project.parent.version}</version>
+      <scope>test</scope>
+    </dependency>
+
     <dependency>
       <groupId>org.apache.bookkeeper</groupId>
       <artifactId>bookkeeper-server</artifactId>
diff --git a/tests/integration/cluster/src/test/resources/log4j.properties b/tests/integration/cluster/src/test/resources/log4j.properties
deleted file mode 100644
index 10ae6bfcb..000000000
--- a/tests/integration/cluster/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,42 +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.
-#
-#
-
-#
-# Bookkeeper Logging Configuration
-#
-
-# Format is "<default threshold> (, <appender>)+
-
-# DEFAULT: console appender only, level INFO
-bookkeeper.root.logger=INFO,CONSOLE
-log4j.rootLogger=${bookkeeper.root.logger}
-
-#
-# Log INFO level and above messages to the console
-#
-log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
-log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
-log4j.appender.CONSOLE.layout.ConversionPattern=%d{ISO8601} - %-5p - [%t:%C{1}@%L] - %m%n
-
-#disable zookeeper logging
-log4j.logger.org.apache.zookeeper=OFF
-log4j.logger.org.apache.bookkeeper.bookie=INFO
-log4j.logger.org.apache.bookkeeper.meta=INFO
diff --git a/tests/integration/standalone/build.gradle b/tests/integration/standalone/build.gradle
index fe63dd3b5..771dfe448 100644
--- a/tests/integration/standalone/build.gradle
+++ b/tests/integration/standalone/build.gradle
@@ -26,6 +26,7 @@ dependencies {
     testImplementation project(':bookkeeper-server')
     testImplementation project(':tests:integration-tests-utils')
     testImplementation project(':tests:integration-tests-topologies')
+    testImplementation project(':testtools')
     testCompileOnly depLibs.lombok
     testImplementation depLibs.arquillianJunitContainer
     testImplementation depLibs.testcontainers
diff --git a/tests/integration/standalone/pom.xml b/tests/integration/standalone/pom.xml
index 874c07cd8..fd859cae4 100644
--- a/tests/integration/standalone/pom.xml
+++ b/tests/integration/standalone/pom.xml
@@ -31,6 +31,13 @@
   <name>Apache BookKeeper :: Tests :: Integration :: Standalone test</name>
 
   <dependencies>
+    <dependency>
+      <groupId>org.apache.bookkeeper</groupId>
+      <artifactId>testtools</artifactId>
+      <version>${project.parent.version}</version>
+      <scope>test</scope>
+    </dependency>
+
     <dependency>
       <groupId>org.apache.bookkeeper</groupId>
       <artifactId>bookkeeper-server</artifactId>
diff --git a/tests/integration/standalone/src/test/resources/log4j.properties b/tests/integration/standalone/src/test/resources/log4j.properties
deleted file mode 100644
index 10ae6bfcb..000000000
--- a/tests/integration/standalone/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,42 +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.
-#
-#
-
-#
-# Bookkeeper Logging Configuration
-#
-
-# Format is "<default threshold> (, <appender>)+
-
-# DEFAULT: console appender only, level INFO
-bookkeeper.root.logger=INFO,CONSOLE
-log4j.rootLogger=${bookkeeper.root.logger}
-
-#
-# Log INFO level and above messages to the console
-#
-log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
-log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
-log4j.appender.CONSOLE.layout.ConversionPattern=%d{ISO8601} - %-5p - [%t:%C{1}@%L] - %m%n
-
-#disable zookeeper logging
-log4j.logger.org.apache.zookeeper=OFF
-log4j.logger.org.apache.bookkeeper.bookie=INFO
-log4j.logger.org.apache.bookkeeper.meta=INFO
diff --git a/circe-checksum/build.gradle b/testtools/build.gradle
similarity index 58%
copy from circe-checksum/build.gradle
copy to testtools/build.gradle
index dca984be7..c606cf6ab 100644
--- a/circe-checksum/build.gradle
+++ b/testtools/build.gradle
@@ -18,26 +18,26 @@
  */
 plugins {
     id 'java'
-    id 'com.adarshr.test-logger'
+    id 'maven-publish'
 }
 
+description = 'Apache BookKeeper :: Test Tools'
+
 dependencies {
-    implementation depLibs.guava
-    implementation depLibs.nettyBuffer
-    implementation depLibs.slf4j
-    testImplementation depLibs.junit
-    testImplementation depLibs.mockito
-}
 
-compileJava {
-    options.headerOutputDirectory = file("${buildDir}/javahGenerated")
-    // override args and remove -Werror
-    // Object.finalize() is deprecated at java 9
-    options.compilerArgs = ["-Xlint:unchecked", "-Xlint:deprecation"]
+
+    compileOnly depLibs.lombok
+    compileOnly depLibs.spotbugsAnnotations
+
+
+
+    testCompileOnly depLibs.lombok
+
+
+    annotationProcessor depLibs.lombok
+    testAnnotationProcessor depLibs.lombok
 }
 
 jar {
-    from (tasks.getByPath(":circe-checksum:src:main:circe:linkRelease").outputs.files.filter { f -> f.isFile()} ) {
-        into "/lib"
-    }
+    archiveBaseName = 'testtools'
 }
diff --git a/bookkeeper-slogger/slf4j/pom.xml b/testtools/pom.xml
similarity index 60%
copy from bookkeeper-slogger/slf4j/pom.xml
copy to testtools/pom.xml
index b44203517..600a4830e 100644
--- a/bookkeeper-slogger/slf4j/pom.xml
+++ b/testtools/pom.xml
@@ -6,33 +6,23 @@
    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.
 -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
     <modelVersion>4.0.0</modelVersion>
     <parent>
-        <artifactId>bookkeeper-slogger-parent</artifactId>
         <groupId>org.apache.bookkeeper</groupId>
+        <artifactId>bookkeeper</artifactId>
         <version>4.16.0-SNAPSHOT</version>
-        <relativePath>..</relativePath>
     </parent>
-    <groupId>org.apache.bookkeeper</groupId>
-    <artifactId>bookkeeper-slogger-slf4j</artifactId>
-    <name>Apache BookKeeper :: Structured Logger :: SLF4J Implementation</name>
-    <dependencies>
-        <dependency>
-            <groupId>org.apache.bookkeeper</groupId>
-            <artifactId>bookkeeper-slogger-api</artifactId>
-            <version>${project.parent.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-api</artifactId>
-        </dependency>
-    </dependencies>
+    <artifactId>testtools</artifactId>
+    <name>Apache BookKeeper :: Test Tools</name>
+    <version>4.16.0-SNAPSHOT</version>
 </project>
diff --git a/metadata-drivers/etcd/src/test/resources/log4j2.xml b/testtools/src/main/resources/log4j2.xml
similarity index 81%
rename from metadata-drivers/etcd/src/test/resources/log4j2.xml
rename to testtools/src/main/resources/log4j2.xml
index 184f58487..12f713a7b 100644
--- a/metadata-drivers/etcd/src/test/resources/log4j2.xml
+++ b/testtools/src/main/resources/log4j2.xml
@@ -1,6 +1,5 @@
 <?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
@@ -8,31 +7,24 @@
     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 status="INFO">
     <Appenders>
         <Console name="Console" target="SYSTEM_OUT">
-            <PatternLayout pattern="%d{ISO8601_OFFSET_DATE_TIME_HHMM} %-5level [%t{12}] %c{1.}@%L - %msg %X%n" />
+            <PatternLayout pattern="%d{ISO8601_OFFSET_DATE_TIME_HHMM} %-5level [%t{12}] %c{1.}@%L - %msg%n" />
         </Console>
     </Appenders>
     <Loggers>
         <Root level="warn">
             <AppenderRef ref="Console" />
         </Root>
-        <Logger name="org.eclipse.jetty" level="info"/>
-        <Logger name="org.apache.pulsar" level="info"/>
         <Logger name="org.apache.bookkeeper" level="info"/>
-        <Logger name="org.apache.kafka" level="info"/>
-        <Logger name="org.testcontainers" level="info"/>
     </Loggers>
 </Configuration>
diff --git a/tools/ledger/build.gradle b/tools/ledger/build.gradle
index ea355fe3a..fdf60f7b3 100644
--- a/tools/ledger/build.gradle
+++ b/tools/ledger/build.gradle
@@ -38,6 +38,7 @@ dependencies {
     implementation depLibs.nettyCodecHTTP
     implementation depLibs.nettyProxy
     testImplementation project(":bookkeeper-stats")
+    testImplementation project(':testtools')
     testCompileOnly depLibs.lombok
     testImplementation depLibs.junit
     testImplementation depLibs.commonsConfiguration
diff --git a/tools/ledger/pom.xml b/tools/ledger/pom.xml
index a3d26be1a..0ba321a34 100644
--- a/tools/ledger/pom.xml
+++ b/tools/ledger/pom.xml
@@ -56,6 +56,12 @@
       <version>${project.parent.version}</version>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.bookkeeper</groupId>
+      <artifactId>testtools</artifactId>
+      <version>${project.parent.version}</version>
+      <scope>test</scope>
+    </dependency>
     <dependency>
       <groupId>org.apache.bookkeeper</groupId>
       <artifactId>bookkeeper-server</artifactId>
diff --git a/tools/ledger/src/test/resources/log4j.properties b/tools/ledger/src/test/resources/log4j.properties
deleted file mode 100644
index 10ae6bfcb..000000000
--- a/tools/ledger/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,42 +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.
-#
-#
-
-#
-# Bookkeeper Logging Configuration
-#
-
-# Format is "<default threshold> (, <appender>)+
-
-# DEFAULT: console appender only, level INFO
-bookkeeper.root.logger=INFO,CONSOLE
-log4j.rootLogger=${bookkeeper.root.logger}
-
-#
-# Log INFO level and above messages to the console
-#
-log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
-log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
-log4j.appender.CONSOLE.layout.ConversionPattern=%d{ISO8601} - %-5p - [%t:%C{1}@%L] - %m%n
-
-#disable zookeeper logging
-log4j.logger.org.apache.zookeeper=OFF
-log4j.logger.org.apache.bookkeeper.bookie=INFO
-log4j.logger.org.apache.bookkeeper.meta=INFO