From 624f81a5a3cdabae30b101b2931f58e295b3b956 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Mon, 20 Jan 2014 10:57:51 +0100 Subject: [PATCH] Improve 'switch off commons-logging' documentation Update reference documentation to make it clearer that only `spring-core` has a direct dependency on `commons-logging`. Also reference the 'empty jar' alternative option as described in the SLF4J FAQ. --- src/asciidoc/index.adoc | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/asciidoc/index.adoc b/src/asciidoc/index.adoc index 027e9ee95ed..03e279e3565 100644 --- a/src/asciidoc/index.adoc +++ b/src/asciidoc/index.adoc @@ -567,9 +567,15 @@ as a new project it would use a different logging dependency. The first choice w probably be the Simple Logging Facade for Java ( http://www.slf4j.org[SLF4J]), which is also used by a lot of other tools that people use with Spring inside their applications. -Switching off `commons-logging` is easy: just make sure it isn't on the classpath at -runtime. In Maven terms you exclude the dependency, and because of the way that the -Spring dependencies are declared, you only have to do that once. +There are basically two ways to switch off `commons-logging`: + +. Exclude the dependency from the `spring-core` module (as it is the only module that + explicitly depends on `commons-logging`) +. Depend on a special `commons-logging` dependency that replaces the library with + an empty jar (more details can be found in the + http://slf4j.org/faq.html#excludingJCL[SLF4J FAQ]) + +To exclude commons-logging, add the following to your `dependencyManagement` section: [source,xml,indent=0] [subs="verbatim,quotes,attributes"] @@ -579,7 +585,6 @@ Spring dependencies are declared, you only have to do that once. org.springframework spring-core {spring-version} - runtime commons-logging @@ -624,7 +629,6 @@ implementation itself. In Maven you would do that like this org.springframework spring-core {spring-version} - runtime commons-logging @@ -636,25 +640,21 @@ implementation itself. In Maven you would do that like this org.slf4j jcl-over-slf4j 1.5.8 - runtime org.slf4j slf4j-api 1.5.8 - runtime org.slf4j slf4j-log4j12 1.5.8 - runtime log4j log4j 1.2.14 - runtime ---- @@ -694,13 +694,11 @@ is your dependency declaration: org.springframework spring-core {spring-version} - runtime log4j log4j 1.2.14 - runtime ----