[slf4j-dev] [GIT] SLF4J: Simple Logging Facade for Java branch master updated. v_1.6.4-2-g3a46131

Gitbot git-noreply at pixie.qos.ch
Sat Nov 12 16:12:52 CET 2011


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "SLF4J: Simple Logging Facade for Java".

The branch, master has been updated
       via  3a461317916651390d83891d3d4b73d9e38dcb28 (commit)
      from  ccd1c8355b9ed6c77b375d7efd459416f10fb62e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.qos.ch/gitweb/?p=slf4j.git;a=commit;h=3a461317916651390d83891d3d4b73d9e38dcb28
http://github.com/ceki/slf4j/commit/3a461317916651390d83891d3d4b73d9e38dcb28

commit 3a461317916651390d83891d3d4b73d9e38dcb28
Author: Ceki Gulcu <ceki at qos.ch>
Date:   Sat Nov 12 16:12:16 2011 +0100

    docs on version 99

diff --git a/slf4j-site/src/site/pages/faq.html b/slf4j-site/src/site/pages/faq.html
index b226ac4..afec6fd 100644
--- a/slf4j-site/src/site/pages/faq.html
+++ b/slf4j-site/src/site/pages/faq.html
@@ -78,7 +78,7 @@
     </li>
 
     <li>
-      <a href="#maven2">What about Maven 2 transitive
+      <a href="#maven2">What about Maven transitive
       dependencies?
       </a>
     </li>
@@ -609,18 +609,19 @@ org.slf4j.impl.StaticLoggerBinder.SINGLETON from class org.slf4j.LoggerFactory
 
    <!-- ======================================================= -->
 
-    <dt><a name="maven2" href="#maven2">What about Maven2
+    <dt><a name="maven2" href="#maven2">What about Maven
     transitive dependencies? </a>
     </dt>
     
     <dd>
-      <p>As an author of a library built with Maven2, you might
-      want to test your application using a binding, say
-      slf4j-log4j12 or logback-classic, without forcing log4j or
-      logback-classic as a dependency upon your users. As of SLF4J
-      version 1.3, this quite easy to accomplish. But first, since
-      your library's code depends on the SLF4J API you will need to
-      declare slf4j-api as a compile-time (default scope)
+      <p>As an author of a library built with Maven, you might want to
+      test your application using a binding, say slf4j-log4j12 or
+      logback-classic, without forcing log4j or logback-classic as a
+      dependency upon your users. This is rather easy to accomplish.
+      </p>
+
+      <p>Given that your library's code depends on the SLF4J API, you
+      will need to declare slf4j-api as a compile-time (default scope)
       dependency.
       </p>
       <pre class="prettyprint source"><dependency>
@@ -662,18 +663,20 @@ org.slf4j.impl.StaticLoggerBinder.SINGLETON from class org.slf4j.LoggerFactory
     </dt>
     
     <dd>
+      <p><b>alternative 1) explicit exlusion</b></p>
+
       <p>Many software projects using Maven declare commons-logging as
       a dependency. Thus, if you wish to migrate to SLF4J or use
-      jcl-over-slf4j, you would need to declare a commons-logging
-      exclusion in all of your dependencies which transitively depend
-      on commons-logging. This can be an error prone process. To
-      alleviate the pain, Erik van Oosten has developed a <a
-      href="http://day-to-day-stuff.blogspot.com/2007/10/announcement-version-99-does-not-exist.html">clever
-      hack around this problem.</a>
+      jcl-over-slf4j, you would need to exclude commons-logging in all
+      of your project's dependencies which transitively depend on
+      commons-logging. Excluding commons-logging explicitly can be a
+      cumbersome and an error prone process.
       </p>
 
-      <p>Alternatively, commons-logging can be rather simply and
-      conveniently excluded as a dependency by declaring it in the
+      <p><b>alternative 2) provided scope</b></p>
+
+      <p>Commons-logging can be rather simply and conveniently
+      excluded as a dependency by declaring it in the
       <em>provided</em> scope within the pom.xml file of your
       project. The actual commons-logging classes would be provided by
       jcl-over-slf4j. This translates into the following pom file
@@ -700,6 +703,66 @@ org.slf4j.impl.StaticLoggerBinder.SINGLETON from class org.slf4j.LoggerFactory
       true.
       </p>
 
+      <p>Unfortunately, while declaring commons-logging in the
+      provided scope gets the job done, your IDE, e.g. Eclipse, will
+      still place <em>commons-logging.jar</em> on your projet's class
+      path as seen by your IDE. You would need to make sure that
+      <em>jcl-over-slf4j.jar</em> is visible before
+      <em>commons-logging.jar</em> by your IDE.
+      </p>
+
+      <p><b>alternative 3) empty artifacts</b></p>
+      
+      <p>An alternative approach is to depend on an empty
+      <em>commons-logging.jar</em> artifact. This clever <a
+      href="http://day-to-day-stuff.blogspot.com/2007/10/announcement-version-99-does-not-exist.html">approach
+      was imagined</a> imagined and initially supported by Erik van
+      Oosten.
+      </p>
+
+      <p>The empty artifact is available from a <a
+      href="http://version99.qos.ch">http://version99.qos.ch</a> a
+      highly available Maven repository, replicated by several hosts
+      located in different geographical regions. The following
+      decleration adds the version99 repository to the set of remote
+      repositories searched by Maven.
+      </p>
+
+      <pre class="prettyprint source"><repositories>
+  <repository>
+    <id>version99</id>
+    <!-- highly available repository serving empty artifacts -->
+    <url>http://version99.qos.ch/</url>
+  </repository>
+</repositories></pre>
+      
+    <p>Once you declare version 99-empty of commons-logging in the
+    <code><dependencyManagement></code> section of your project,
+    all transtive dependencies for commons-logging will also use
+    version 99-empty, thus nicely addressing the commons-logging
+    exclusion problem.
+    </p>
+    
+<pre class="prettyprint source"><dependencyManagement>
+  <dependency>
+    <groupId>commons-logging</groupId>
+    <artifactId>commons-logging</artifactId>
+    <version><b>99-empty</b></version>
+  </dependency>
+  ... other declarations...
+</dependencyManagement>
+
+<!-- let's not forget to declare a dependency on jcl-over-slf4j -->
+<dependencies>
+  <dependency>
+    <groupId>org.slf4j</groupId>
+    <artifactId>jcl-over-slf4j</artifactId>
+    <version>${project.version}</version>
+  </dependency>
+<dependencies>
+</pre>
+
+
     </dd>
     
     

-----------------------------------------------------------------------

Summary of changes:
 slf4j-site/src/site/pages/faq.html |   97 +++++++++++++++++++++++++++++------
 1 files changed, 80 insertions(+), 17 deletions(-)


hooks/post-receive
-- 
SLF4J: Simple Logging Facade for Java


More information about the slf4j-dev mailing list