From 4a01fe53de6ca96393134466bcccbcc6d6f341c3 Mon Sep 17 00:00:00 2001 From: Tres Finocchiaro Date: Fri, 1 Dec 2023 01:00:24 -0500 Subject: [PATCH] Remove slf4j from unit tests (broken) --- pom.xml | 13 +++++++++++++ src/test/java/jssc/junit/rules/VirtualPortRule.java | 8 +++++--- src/test/java/resources/log4j.properties | 4 ++++ 3 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 src/test/java/resources/log4j.properties diff --git a/pom.xml b/pom.xml index f5a20a102..c812f6de1 100644 --- a/pom.xml +++ b/pom.xml @@ -52,6 +52,7 @@ 4.12 + 2.22.0 1.2.3 2.5.0 @@ -81,6 +82,18 @@ native-lib-loader ${dependency.nativelibloader.version} + + org.apache.logging.log4j + log4j-api + ${dependency.log4j.version} + test + + + org.apache.logging.log4j + log4j-core + ${dependency.log4j.version} + test + junit junit diff --git a/src/test/java/jssc/junit/rules/VirtualPortRule.java b/src/test/java/jssc/junit/rules/VirtualPortRule.java index 7512d9cd6..f6dc448a9 100644 --- a/src/test/java/jssc/junit/rules/VirtualPortRule.java +++ b/src/test/java/jssc/junit/rules/VirtualPortRule.java @@ -32,16 +32,18 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + import jssc.SerialNativeInterface; import org.junit.rules.TestRule; import org.junit.runner.Description; import org.junit.runners.model.Statement; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; public class VirtualPortRule implements TestRule { - private static final Logger LOG = LoggerFactory.getLogger(VirtualPortRule.class); + private static final Logger LOG = LogManager.getLogger(VirtualPortRule.class); private static final ExecutorService executor = Executors.newCachedThreadPool(); diff --git a/src/test/java/resources/log4j.properties b/src/test/java/resources/log4j.properties new file mode 100644 index 000000000..b6f16c71e --- /dev/null +++ b/src/test/java/resources/log4j.properties @@ -0,0 +1,4 @@ +# Logging settings for unit tests + +# TODO: Why isn't this being recognized/honored by log4j? +log4j.rootLogger=ALL \ No newline at end of file