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.
This commit is contained in:
parent
ab5f1256bf
commit
624f81a5a3
|
|
@ -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
|
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.
|
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
|
There are basically two ways to switch off `commons-logging`:
|
||||||
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.
|
. 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]
|
[source,xml,indent=0]
|
||||||
[subs="verbatim,quotes,attributes"]
|
[subs="verbatim,quotes,attributes"]
|
||||||
|
|
@ -579,7 +585,6 @@ Spring dependencies are declared, you only have to do that once.
|
||||||
<groupId>org.springframework</groupId>
|
<groupId>org.springframework</groupId>
|
||||||
<artifactId>spring-core</artifactId>
|
<artifactId>spring-core</artifactId>
|
||||||
<version>{spring-version}</version>
|
<version>{spring-version}</version>
|
||||||
<scope>runtime</scope>
|
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
<groupId>commons-logging</groupId>
|
<groupId>commons-logging</groupId>
|
||||||
|
|
@ -624,7 +629,6 @@ implementation itself. In Maven you would do that like this
|
||||||
<groupId>org.springframework</groupId>
|
<groupId>org.springframework</groupId>
|
||||||
<artifactId>spring-core</artifactId>
|
<artifactId>spring-core</artifactId>
|
||||||
<version>{spring-version}</version>
|
<version>{spring-version}</version>
|
||||||
<scope>runtime</scope>
|
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
<groupId>commons-logging</groupId>
|
<groupId>commons-logging</groupId>
|
||||||
|
|
@ -636,25 +640,21 @@ implementation itself. In Maven you would do that like this
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
<artifactId>jcl-over-slf4j</artifactId>
|
<artifactId>jcl-over-slf4j</artifactId>
|
||||||
<version>1.5.8</version>
|
<version>1.5.8</version>
|
||||||
<scope>runtime</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
<artifactId>slf4j-api</artifactId>
|
<artifactId>slf4j-api</artifactId>
|
||||||
<version>1.5.8</version>
|
<version>1.5.8</version>
|
||||||
<scope>runtime</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
<artifactId>slf4j-log4j12</artifactId>
|
<artifactId>slf4j-log4j12</artifactId>
|
||||||
<version>1.5.8</version>
|
<version>1.5.8</version>
|
||||||
<scope>runtime</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>log4j</groupId>
|
<groupId>log4j</groupId>
|
||||||
<artifactId>log4j</artifactId>
|
<artifactId>log4j</artifactId>
|
||||||
<version>1.2.14</version>
|
<version>1.2.14</version>
|
||||||
<scope>runtime</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
----
|
----
|
||||||
|
|
@ -694,13 +694,11 @@ is your dependency declaration:
|
||||||
<groupId>org.springframework</groupId>
|
<groupId>org.springframework</groupId>
|
||||||
<artifactId>spring-core</artifactId>
|
<artifactId>spring-core</artifactId>
|
||||||
<version>{spring-version}</version>
|
<version>{spring-version}</version>
|
||||||
<scope>runtime</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>log4j</groupId>
|
<groupId>log4j</groupId>
|
||||||
<artifactId>log4j</artifactId>
|
<artifactId>log4j</artifactId>
|
||||||
<version>1.2.14</version>
|
<version>1.2.14</version>
|
||||||
<scope>runtime</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
----
|
----
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue