From 486afbc08d4689105019f77bf1ca0d1a2fc5ab0f Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Thu, 16 Dec 2021 18:42:45 +0100 Subject: [PATCH] Use slf4j-simple instead of log4j for logging JGit uses slf4j-api as logging API. The libraries - org.eclipse.jgit.http.test - org.eclipse.jgit.pgm - org.eclipse.jgit.ssh.apache.test - org.eclipse.jgit.test used the outdated log4j 1.2.15 which is EOL since years. Since both jgit command line and also the tests don't need sophisticated logging features replace log4j with the much simpler slf4j-simple log implementation. The org.slf4j.binding.simple 1.7.30 archive has only 25kB instead of 429kB for log4j 1.2.15 Applications using jgit are free to choose any other log implementation supporting slf4j API. Change-Id: I89e85cd3c76e954c3434622510975ce65dc227d4 --- lib/BUILD | 1 - org.eclipse.jgit.http.test/build.properties | 3 +- .../org.eclipse.jgit.repository/category.xml | 10 ++----- .../org.eclipse.jgit.target/jgit-4.10.target | 8 ++---- .../org.eclipse.jgit.target/jgit-4.11.target | 8 ++---- .../org.eclipse.jgit.target/jgit-4.12.target | 8 ++---- .../org.eclipse.jgit.target/jgit-4.13.target | 8 ++---- .../org.eclipse.jgit.target/jgit-4.14.target | 8 ++---- .../org.eclipse.jgit.target/jgit-4.15.target | 8 ++---- .../org.eclipse.jgit.target/jgit-4.16.target | 8 ++---- .../org.eclipse.jgit.target/jgit-4.17.target | 8 ++---- .../org.eclipse.jgit.target/jgit-4.18.target | 8 ++---- .../org.eclipse.jgit.target/jgit-4.19.target | 8 ++---- .../org.eclipse.jgit.target/jgit-4.20.target | 8 ++---- .../org.eclipse.jgit.target/jgit-4.21.target | 8 ++---- .../org.eclipse.jgit.target/jgit-4.6.target | 8 ++---- .../org.eclipse.jgit.target/jgit-4.7.target | 8 ++---- .../org.eclipse.jgit.target/jgit-4.8.target | 8 ++---- .../org.eclipse.jgit.target/jgit-4.9.target | 8 ++---- .../orbit/R20211213173813-2021-12.tpd | 6 ++-- org.eclipse.jgit.pgm/build.properties | 2 +- org.eclipse.jgit.pgm/pom.xml | 7 +---- .../resources/log4j.properties | 6 ---- .../resources/simplelogger.properties | 6 ++++ .../build.properties | 3 +- org.eclipse.jgit.test/build.properties | 3 +- org.eclipse.jgit.test/tests.bzl | 3 +- .../tst-rsrc/log4j.properties | 14 ---------- .../tst-rsrc/simplelogger.properties | 12 ++++---- ...SecurityManagerMissingPermissionsTest.java | 28 ++++++++----------- .../jgit/transport/WalkEncryptionTest.java | 2 +- pom.xml | 27 +----------------- 32 files changed, 84 insertions(+), 177 deletions(-) delete mode 100644 org.eclipse.jgit.pgm/resources/log4j.properties create mode 100644 org.eclipse.jgit.pgm/resources/simplelogger.properties delete mode 100644 org.eclipse.jgit.test/tst-rsrc/log4j.properties diff --git a/lib/BUILD b/lib/BUILD index 1901be8ec8..68344e4f6f 100644 --- a/lib/BUILD +++ b/lib/BUILD @@ -260,7 +260,6 @@ java_library( java_library( name = "slf4j-simple", - testonly = 1, visibility = ["//visibility:public"], exports = ["@slf4j-simple//jar"], ) diff --git a/org.eclipse.jgit.http.test/build.properties b/org.eclipse.jgit.http.test/build.properties index a909f1301f..a12a660466 100644 --- a/org.eclipse.jgit.http.test/build.properties +++ b/org.eclipse.jgit.http.test/build.properties @@ -4,5 +4,4 @@ output.. = bin/ bin.includes = META-INF/,\ .,\ plugin.properties -additional.bundles = org.apache.log4j,\ - org.slf4j.binding.log4j12 +additional.bundles = org.slf4j.binding.simple diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.repository/category.xml b/org.eclipse.jgit.packaging/org.eclipse.jgit.repository/category.xml index ca0935a514..3417e09e9b 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.repository/category.xml +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.repository/category.xml @@ -111,12 +111,6 @@ - - - - - - @@ -165,10 +159,10 @@ - + - + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.target index 29f9fa85d4..6a6354498a 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.target @@ -1,7 +1,7 @@ - + @@ -53,8 +53,6 @@ - - @@ -85,8 +83,8 @@ - - + + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.target index 82136cdc9f..a0c771023b 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.target @@ -1,7 +1,7 @@ - + @@ -53,8 +53,6 @@ - - @@ -85,8 +83,8 @@ - - + + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.target index ba09b5f258..21a5797fee 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.target @@ -1,7 +1,7 @@ - + @@ -53,8 +53,6 @@ - - @@ -85,8 +83,8 @@ - - + + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.target index 527ac100aa..e7e9c68ce0 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.target @@ -1,7 +1,7 @@ - + @@ -53,8 +53,6 @@ - - @@ -85,8 +83,8 @@ - - + + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14.target index b55efc0cad..aa104b587a 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14.target @@ -1,7 +1,7 @@ - + @@ -53,8 +53,6 @@ - - @@ -85,8 +83,8 @@ - - + + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.15.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.15.target index acfc9d35e1..9854511e59 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.15.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.15.target @@ -1,7 +1,7 @@ - + @@ -53,8 +53,6 @@ - - @@ -85,8 +83,8 @@ - - + + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.16.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.16.target index 50e7402821..202faf1206 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.16.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.16.target @@ -1,7 +1,7 @@ - + @@ -53,8 +53,6 @@ - - @@ -85,8 +83,8 @@ - - + + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.17.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.17.target index 8426ef8ef9..a0ea860d4e 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.17.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.17.target @@ -1,7 +1,7 @@ - + @@ -53,8 +53,6 @@ - - @@ -85,8 +83,8 @@ - - + + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.18.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.18.target index ba83922272..168ae2ce44 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.18.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.18.target @@ -1,7 +1,7 @@ - + @@ -53,8 +53,6 @@ - - @@ -85,8 +83,8 @@ - - + + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.19.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.19.target index 56e6d410a8..a686b5feaa 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.19.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.19.target @@ -1,7 +1,7 @@ - + @@ -53,8 +53,6 @@ - - @@ -85,8 +83,8 @@ - - + + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.20.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.20.target index 278ecffc1b..86183bfb8d 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.20.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.20.target @@ -1,7 +1,7 @@ - + @@ -53,8 +53,6 @@ - - @@ -85,8 +83,8 @@ - - + + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.21.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.21.target index 7551b43a12..4d6beef6a0 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.21.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.21.target @@ -1,7 +1,7 @@ - + @@ -53,8 +53,6 @@ - - @@ -85,8 +83,8 @@ - - + + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.target index 69d88bf1ff..d56f3d691d 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.target @@ -1,7 +1,7 @@ - + @@ -53,8 +53,6 @@ - - @@ -85,8 +83,8 @@ - - + + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.target index 78005a898f..8f82cfa289 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.target @@ -1,7 +1,7 @@ - + @@ -53,8 +53,6 @@ - - @@ -85,8 +83,8 @@ - - + + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.target index 7d4a78d00b..cc02ef59ac 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.target @@ -1,7 +1,7 @@ - + @@ -53,8 +53,6 @@ - - @@ -85,8 +83,8 @@ - - + + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.target index 5edf365f18..997abb4e05 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.target +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.target @@ -1,7 +1,7 @@ - + @@ -53,8 +53,6 @@ - - @@ -85,8 +83,8 @@ - - + + diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/R20211213173813-2021-12.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/R20211213173813-2021-12.tpd index ecb01deb90..aeeed562be 100644 --- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/R20211213173813-2021-12.tpd +++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/R20211213173813-2021-12.tpd @@ -30,8 +30,6 @@ location "https://download.eclipse.org/tools/orbit/downloads/drops/R202112131738 org.apache.httpcomponents.httpclient.source [4.5.13.v20210128-2225,4.5.13.v20210128-2225] org.apache.httpcomponents.httpcore [4.4.14.v20210128-2225,4.4.14.v20210128-2225] org.apache.httpcomponents.httpcore.source [4.4.14.v20210128-2225,4.4.14.v20210128-2225] - org.apache.log4j [1.2.15.v201012070815,1.2.15.v201012070815] - org.apache.log4j.source [1.2.15.v201012070815,1.2.15.v201012070815] org.apache.sshd.osgi [2.7.0.v20210623-0618,2.7.0.v20210623-0618] org.apache.sshd.osgi.source [2.7.0.v20210623-0618,2.7.0.v20210623-0618] org.apache.sshd.sftp [2.7.0.v20210623-0618,2.7.0.v20210623-0618] @@ -62,8 +60,8 @@ location "https://download.eclipse.org/tools/orbit/downloads/drops/R202112131738 org.objenesis.source [2.6.0.v20180420-1519,2.6.0.v20180420-1519] org.slf4j.api [1.7.30.v20200204-2150,1.7.30.v20200204-2150] org.slf4j.api.source [1.7.30.v20200204-2150,1.7.30.v20200204-2150] - org.slf4j.binding.log4j12 [1.7.30.v20201108-2042,1.7.30.v20201108-2042] - org.slf4j.binding.log4j12.source [1.7.30.v20201108-2042,1.7.30.v20201108-2042] + org.slf4j.binding.simple [1.7.30.v20200204-2150,1.7.30.v20200204-2150] + org.slf4j.binding.simple.source [1.7.30.v20200204-2150,1.7.30.v20200204-2150] org.tukaani.xz [1.9.0.v20210624-1259,1.9.0.v20210624-1259] org.tukaani.xz.source [1.9.0.v20210624-1259,1.9.0.v20210624-1259] } diff --git a/org.eclipse.jgit.pgm/build.properties b/org.eclipse.jgit.pgm/build.properties index 4b38114d09..302dded85a 100644 --- a/org.eclipse.jgit.pgm/build.properties +++ b/org.eclipse.jgit.pgm/build.properties @@ -6,4 +6,4 @@ bin.includes = META-INF/,\ .,\ plugin.properties,\ about.html,\ - resources/log4j.properties + resources/simplelogger.properties diff --git a/org.eclipse.jgit.pgm/pom.xml b/org.eclipse.jgit.pgm/pom.xml index f8ec120ce5..1441bddf19 100644 --- a/org.eclipse.jgit.pgm/pom.xml +++ b/org.eclipse.jgit.pgm/pom.xml @@ -97,12 +97,7 @@ org.slf4j - slf4j-log4j12 - - - - log4j - log4j + slf4j-simple diff --git a/org.eclipse.jgit.pgm/resources/log4j.properties b/org.eclipse.jgit.pgm/resources/log4j.properties deleted file mode 100644 index 1496c5a2cf..0000000000 --- a/org.eclipse.jgit.pgm/resources/log4j.properties +++ /dev/null @@ -1,6 +0,0 @@ -log4j.rootLogger=WARN, stderr - -log4j.appender.stderr=org.apache.log4j.ConsoleAppender -log4j.appender.stderr.Target=System.err -log4j.appender.stderr.layout=org.apache.log4j.PatternLayout -log4j.appender.stderr.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n \ No newline at end of file diff --git a/org.eclipse.jgit.pgm/resources/simplelogger.properties b/org.eclipse.jgit.pgm/resources/simplelogger.properties new file mode 100644 index 0000000000..98c19ce01d --- /dev/null +++ b/org.eclipse.jgit.pgm/resources/simplelogger.properties @@ -0,0 +1,6 @@ +org.slf4j.simpleLogger.defaultLogLevel=warn +org.slf4j.simpleLogger.logFile=System.err +org.slf4j.simpleLogger.showDateTime=true +org.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd HH:mm:ss +org.slf4j.simpleLogger.showThreadName=true +org.slf4j.simpleLogger.showLogName=true diff --git a/org.eclipse.jgit.ssh.apache.test/build.properties b/org.eclipse.jgit.ssh.apache.test/build.properties index 406c5a768f..35d7145160 100644 --- a/org.eclipse.jgit.ssh.apache.test/build.properties +++ b/org.eclipse.jgit.ssh.apache.test/build.properties @@ -3,5 +3,4 @@ output.. = bin/ bin.includes = META-INF/,\ .,\ plugin.properties -additional.bundles = org.apache.log4j,\ - org.slf4j.binding.log4j12 +additional.bundles = org.slf4j.binding.simple diff --git a/org.eclipse.jgit.test/build.properties b/org.eclipse.jgit.test/build.properties index b527a74790..212c8bd4d7 100644 --- a/org.eclipse.jgit.test/build.properties +++ b/org.eclipse.jgit.test/build.properties @@ -7,5 +7,4 @@ bin.includes = META-INF/,\ plugin.properties,\ bin-tst/,\ bin/ -additional.bundles = org.apache.log4j,\ - org.slf4j.binding.log4j12 +additional.bundles = org.slf4j.binding.simple diff --git a/org.eclipse.jgit.test/tests.bzl b/org.eclipse.jgit.test/tests.bzl index 34df07d5e6..e201bdbcb3 100644 --- a/org.eclipse.jgit.test/tests.bzl +++ b/org.eclipse.jgit.test/tests.bzl @@ -36,7 +36,7 @@ def tests(tests): ] if src.endswith("SecurityManagerMissingPermissionsTest.java"): additional_deps = [ - "//lib:log4j", + "//lib:slf4j-simple", ] if src.endswith("JDKHttpConnectionTest.java"): additional_deps = [ @@ -68,6 +68,7 @@ def tests(tests): "//lib:javaewah", "//lib:junit", "//lib:slf4j-api", + "//lib:slf4j-simple", "//org.eclipse.jgit:jgit", "//org.eclipse.jgit.junit:junit", "//org.eclipse.jgit.lfs:jgit-lfs", diff --git a/org.eclipse.jgit.test/tst-rsrc/log4j.properties b/org.eclipse.jgit.test/tst-rsrc/log4j.properties deleted file mode 100644 index 856a731ab9..0000000000 --- a/org.eclipse.jgit.test/tst-rsrc/log4j.properties +++ /dev/null @@ -1,14 +0,0 @@ - -# Root logger option -log4j.rootLogger=INFO, stdout - -# Direct log messages to stdout -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.Target=System.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n -log4j.appender.fileLogger.bufferedIO = true -log4j.appender.fileLogger.bufferSize = 4096 - -#log4j.logger.org.eclipse.jgit.util.FS = DEBUG -#log4j.logger.org.eclipse.jgit.internal.storage.file.FileSnapshot = DEBUG diff --git a/org.eclipse.jgit.test/tst-rsrc/simplelogger.properties b/org.eclipse.jgit.test/tst-rsrc/simplelogger.properties index 011b2f8bb0..235fea21ac 100644 --- a/org.eclipse.jgit.test/tst-rsrc/simplelogger.properties +++ b/org.eclipse.jgit.test/tst-rsrc/simplelogger.properties @@ -1,9 +1,9 @@ -org.slf4j.simpleLogger.logFile = System.err -org.slf4j.simpleLogger.cacheOutputStream = true -org.slf4j.simpleLogger.defaultLogLevel = info -org.slf4j.simpleLogger.showDateTime = true -org.slf4j.simpleLogger.dateTimeFormat = HH:mm:ss.SSSXXX -org.slf4j.simpleLogger.showThreadName = true +org.slf4j.simpleLogger.defaultLogLevel=info +org.slf4j.simpleLogger.logFile=System.err +org.slf4j.simpleLogger.showDateTime=true +org.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd HH:mm:ss +org.slf4j.simpleLogger.showThreadName=true +org.slf4j.simpleLogger.showLogName=true #org.slf4j.simpleLogger.log.org.eclipse.jgit.util.FS = debug #org.slf4j.simpleLogger.log.org.eclipse.jgit.internal.storage.file.FileSnapshot = debug diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/SecurityManagerMissingPermissionsTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/SecurityManagerMissingPermissionsTest.java index a07f37009e..d0fbdbd090 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/SecurityManagerMissingPermissionsTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/SecurityManagerMissingPermissionsTest.java @@ -13,17 +13,15 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; +import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; -import java.io.StringWriter; +import java.io.PrintStream; import java.nio.file.Files; import java.nio.file.Path; import java.security.Policy; import java.util.Collections; -import org.apache.log4j.Logger; -import org.apache.log4j.PatternLayout; -import org.apache.log4j.WriterAppender; import org.eclipse.jgit.junit.RepositoryTestCase; import org.eclipse.jgit.util.FileUtils; import org.junit.After; @@ -38,25 +36,21 @@ public class SecurityManagerMissingPermissionsTest extends RepositoryTestCase { /** * Collects all logging sent to the logging system. */ - private final StringWriter errorOutputWriter = new StringWriter(); - - /** - * Appender to intercept all logging sent to the logging system. - */ - private WriterAppender appender; + private final ByteArrayOutputStream errorOutput = new ByteArrayOutputStream(); private SecurityManager originalSecurityManager; + private PrintStream defaultErrorOutput; + @Override @Before public void setUp() throws Exception { originalSecurityManager = System.getSecurityManager(); - appender = new WriterAppender( - new PatternLayout(PatternLayout.TTCC_CONVERSION_PATTERN), - errorOutputWriter); - - Logger.getRootLogger().addAppender(appender); + // slf4j-simple logs to System.err, redirect it to enable asserting + // logged errors + defaultErrorOutput = System.err; + System.setErr(new PrintStream(errorOutput)); refreshPolicyAllPermission(Policy.getPolicy()); System.setSecurityManager(new SecurityManager()); @@ -85,14 +79,14 @@ public class SecurityManagerMissingPermissionsTest extends RepositoryTestCase { addRepoToClose(git.getRepository()); - assertEquals("", errorOutputWriter.toString()); + assertEquals("", errorOutput.toString()); } @Override @After public void tearDown() throws Exception { System.setSecurityManager(originalSecurityManager); - Logger.getRootLogger().removeAppender(appender); + System.setErr(defaultErrorOutput); super.tearDown(); } diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/WalkEncryptionTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/WalkEncryptionTest.java index f289a922bb..5adf7faf20 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/WalkEncryptionTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/WalkEncryptionTest.java @@ -99,7 +99,7 @@ import org.slf4j.LoggerFactory; public class WalkEncryptionTest { /** - * Logger setup: ${project_loc}/tst-rsrc/log4j.properties + * Logger setup: ${project_loc}/tst-rsrc/simplelogger.properties */ static final Logger logger = LoggerFactory.getLogger(WalkEncryptionTest.class); diff --git a/pom.xml b/pom.xml index 5f73b2a316..d73e77fe8f 100644 --- a/pom.xml +++ b/pom.xml @@ -167,7 +167,6 @@ 4.5.13 4.4.14 1.7.30 - 1.2.15 3.3.1 1.7.0 2.8.8 @@ -743,34 +742,10 @@ org.slf4j - slf4j-log4j12 + slf4j-simple ${slf4j-version} - - log4j - log4j - ${log4j-version} - - - javax.mail - mail - - - javax.jms - jms - - - com.sun.jdmk - jmxtools - - - com.sun.jmx - jmxri - - - - com.google.code.gson gson -- 2.39.5