Skip to content

Commit 2dcbf4d

Browse files
author
Phillip Webb
committed
Merge pull request #445 from snicoll/commons-logging-doc
* commons-logging-doc: Improve 'switch off commons-logging' documentation
2 parents ab5f125 + 624f81a commit 2dcbf4d

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

src/asciidoc/index.adoc

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -567,9 +567,15 @@ as a new project it would use a different logging dependency. The first choice w
567567
probably be the Simple Logging Facade for Java ( http://www.slf4j.org[SLF4J]), which is
568568
also used by a lot of other tools that people use with Spring inside their applications.
569569

570-
Switching off `commons-logging` is easy: just make sure it isn't on the classpath at
571-
runtime. In Maven terms you exclude the dependency, and because of the way that the
572-
Spring dependencies are declared, you only have to do that once.
570+
There are basically two ways to switch off `commons-logging`:
571+
572+
. Exclude the dependency from the `spring-core` module (as it is the only module that
573+
explicitly depends on `commons-logging`)
574+
. Depend on a special `commons-logging` dependency that replaces the library with
575+
an empty jar (more details can be found in the
576+
http://slf4j.org/faq.html#excludingJCL[SLF4J FAQ])
577+
578+
To exclude commons-logging, add the following to your `dependencyManagement` section:
573579

574580
[source,xml,indent=0]
575581
[subs="verbatim,quotes,attributes"]
@@ -579,7 +585,6 @@ Spring dependencies are declared, you only have to do that once.
579585
<groupId>org.springframework</groupId>
580586
<artifactId>spring-core</artifactId>
581587
<version>{spring-version}</version>
582-
<scope>runtime</scope>
583588
<exclusions>
584589
<exclusion>
585590
<groupId>commons-logging</groupId>
@@ -624,7 +629,6 @@ implementation itself. In Maven you would do that like this
624629
<groupId>org.springframework</groupId>
625630
<artifactId>spring-core</artifactId>
626631
<version>{spring-version}</version>
627-
<scope>runtime</scope>
628632
<exclusions>
629633
<exclusion>
630634
<groupId>commons-logging</groupId>
@@ -636,25 +640,21 @@ implementation itself. In Maven you would do that like this
636640
<groupId>org.slf4j</groupId>
637641
<artifactId>jcl-over-slf4j</artifactId>
638642
<version>1.5.8</version>
639-
<scope>runtime</scope>
640643
</dependency>
641644
<dependency>
642645
<groupId>org.slf4j</groupId>
643646
<artifactId>slf4j-api</artifactId>
644647
<version>1.5.8</version>
645-
<scope>runtime</scope>
646648
</dependency>
647649
<dependency>
648650
<groupId>org.slf4j</groupId>
649651
<artifactId>slf4j-log4j12</artifactId>
650652
<version>1.5.8</version>
651-
<scope>runtime</scope>
652653
</dependency>
653654
<dependency>
654655
<groupId>log4j</groupId>
655656
<artifactId>log4j</artifactId>
656657
<version>1.2.14</version>
657-
<scope>runtime</scope>
658658
</dependency>
659659
</dependencies>
660660
----
@@ -694,13 +694,11 @@ is your dependency declaration:
694694
<groupId>org.springframework</groupId>
695695
<artifactId>spring-core</artifactId>
696696
<version>{spring-version}</version>
697-
<scope>runtime</scope>
698697
</dependency>
699698
<dependency>
700699
<groupId>log4j</groupId>
701700
<artifactId>log4j</artifactId>
702701
<version>1.2.14</version>
703-
<scope>runtime</scope>
704702
</dependency>
705703
</dependencies>
706704
----

0 commit comments

Comments
 (0)