From ba4cce36abdbc5aae4e5226bb60a0187364229dd Mon Sep 17 00:00:00 2001 From: Chris Rankin Date: Mon, 13 Mar 2017 15:57:17 +0000 Subject: [PATCH] Use SLF4J's version of the commons-logging bindings. Only include SLF4J's Log4J back-end for actual applications, e.g. Node. (#350) --- build.gradle | 1 + client/build.gradle | 4 ---- core/build.gradle | 12 ++++++++++-- node/build.gradle | 9 ++++++--- test-utils/build.gradle | 13 ++++++------- 5 files changed, 23 insertions(+), 16 deletions(-) diff --git a/build.gradle b/build.gradle index fba4305d3e..1cfe75285a 100644 --- a/build.gradle +++ b/build.gradle @@ -19,6 +19,7 @@ buildscript { ext.jersey_version = '2.25' ext.jolokia_version = '2.0.0-M3' ext.assertj_version = '3.6.1' + ext.slf4j_version = '1.7.22' ext.log4j_version = '2.7' ext.bouncycastle_version = '1.56' ext.guava_version = '19.0' diff --git a/client/build.gradle b/client/build.gradle index 4878aede15..b7f126651f 100644 --- a/client/build.gradle +++ b/client/build.gradle @@ -47,10 +47,6 @@ dependencies { compile project(":core") compile project(':node') - // Log4J: logging framework (with SLF4J bindings) - compile "org.apache.logging.log4j:log4j-slf4j-impl:${log4j_version}" - compile "org.apache.logging.log4j:log4j-core:${log4j_version}" - compile "com.google.guava:guava:$guava_version" // ReactFX: Functional reactive UI programming. diff --git a/core/build.gradle b/core/build.gradle index 4445fc058e..56ef82f2f5 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -50,10 +50,12 @@ dependencies { // Thread safety annotations compile "com.google.code.findbugs:jsr305:3.0.1" - // Log4J: logging framework (with SLF4J bindings) - compile "org.apache.logging.log4j:log4j-slf4j-impl:${log4j_version}" + // Log4J: logging framework (ONLY explicitly referenced by net.corda.core.utilities.Logging.kt) compile "org.apache.logging.log4j:log4j-core:${log4j_version}" + // SLF4J: commons-logging bindings for a SLF4J back end + compile "org.slf4j:jcl-over-slf4j:$slf4j_version" + // AssertJ: for fluent assertions for testing testCompile "org.assertj:assertj-core:${assertj_version}" @@ -96,3 +98,9 @@ dependencies { // Requery: SQL based query & persistence for Kotlin compile "io.requery:requery-kotlin:$requery_version" } + +configurations.compile { + // We want to use SLF4J's version of these binding: jcl-over-slf4j + // Remove any transitive dependency on Apache's version. + exclude group: 'commons-logging', module: 'commons-logging' +} diff --git a/node/build.gradle b/node/build.gradle index 0ae6437e49..945ec15cf6 100644 --- a/node/build.gradle +++ b/node/build.gradle @@ -73,7 +73,6 @@ dependencies { // Log4J: logging framework (with SLF4J bindings) compile "org.apache.logging.log4j:log4j-slf4j-impl:${log4j_version}" - compile "org.apache.logging.log4j:log4j-core:${log4j_version}" compile "org.apache.logging.log4j:log4j-web:${log4j_version}" compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" @@ -109,8 +108,6 @@ dependencies { // TODO: Remove this dependency and the code that requires it compile "commons-fileupload:commons-fileupload:1.3.2" - // Force commons logging to version 1.2 to override Artemis, which pulls in 1.1.3 (ARTEMIS-424) - compile "commons-logging:commons-logging:1.2" compile "com.fasterxml.jackson.core:jackson-annotations:${jackson_version}" // Coda Hale's Metrics: for monitoring of key statistics @@ -170,6 +167,12 @@ dependencies { integrationTestCompile "junit:junit:$junit_version" } +configurations.compile { + // We want to use SLF4J's version of these binding: jcl-over-slf4j + // Remove any transitive dependency on Apache's version. + exclude group: 'commons-logging', module: 'commons-logging' +} + task integrationTest(type: Test) { testClassesDir = sourceSets.integrationTest.output.classesDir classpath = sourceSets.integrationTest.runtimeClasspath diff --git a/test-utils/build.gradle b/test-utils/build.gradle index ff3283245d..41b60836dc 100644 --- a/test-utils/build.gradle +++ b/test-utils/build.gradle @@ -28,19 +28,12 @@ dependencies { compile project(':node') compile project(':node:webserver') - // Log4J: logging framework (with SLF4J bindings) - compile "org.apache.logging.log4j:log4j-slf4j-impl:${log4j_version}" - compile "org.apache.logging.log4j:log4j-core:${log4j_version}" - compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" compile "org.jetbrains.kotlin:kotlin-test:$kotlin_version" compile "com.google.guava:guava:$guava_version" - // Force commons logging to version 1.2 to override Artemis, which pulls in 1.1.3 (ARTEMIS-424) - compile "commons-logging:commons-logging:1.2" - // Unit testing helpers. compile "junit:junit:$junit_version" @@ -50,3 +43,9 @@ dependencies { // OkHTTP: Simple HTTP library. compile "com.squareup.okhttp3:okhttp:$okhttp_version" } + +configurations.compile { + // We want to use SLF4J's version of these bindings: jcl-over-slf4j + // Remove any transitive dependency on Apache's version. + exclude group: 'commons-logging', module: 'commons-logging' +}