[slf4j-dev] [GIT] SLF4J: Simple Logging Facade for Java branch, master, updated. a3c95b1a1d4bfc06442919e5a0108333738f5bbe

added by portage for gitosis-gentoo git-noreply at pixie.qos.ch
Mon Aug 24 14:40:09 CEST 2009


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  a3c95b1a1d4bfc06442919e5a0108333738f5bbe (commit)
      from  7a7cf32a3e2a9e5bdc4809f5c6a4e9cc0b120ee0 (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=a3c95b1a1d4bfc06442919e5a0108333738f5bbe
http://github.com/ceki/slf4j/commit/a3c95b1a1d4bfc06442919e5a0108333738f5bbe

commit a3c95b1a1d4bfc06442919e5a0108333738f5bbe
Author: Ceki Gulcu <ceki at qos.ch>
Date:   Mon Aug 24 14:37:50 2009 +0200

    This commit completes commit 7a7cf32a3e2a9e5bdc4809f5c6a4e9cc0b120ee0
    
        - updated javadocs.
    
         Added blurb about the performance impact of JUL to SLF4J translation.
         Other indentation changes
    
        - edited legacy.html.
    
          Usage instructions for SLF4JBridgeHandler are found in the javadocs of
          SLF4JBridgeHandler.
    
        - updated .gitignore file

diff --git a/.gitignore b/.gitignore
index a728ab3..9539fb5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,5 @@
-*~
+.settings
+target
+.classpath
+.project
+*~
\ No newline at end of file
diff --git a/jul-to-slf4j/src/main/java/org/slf4j/bridge/SLF4JBridgeHandler.java b/jul-to-slf4j/src/main/java/org/slf4j/bridge/SLF4JBridgeHandler.java
index 8618944..b065185 100644
--- a/jul-to-slf4j/src/main/java/org/slf4j/bridge/SLF4JBridgeHandler.java
+++ b/jul-to-slf4j/src/main/java/org/slf4j/bridge/SLF4JBridgeHandler.java
@@ -75,6 +75,19 @@ import org.slf4j.spi.LocationAwareLogger;
  * julLogger.fine(&quot;hello world&quot;); // this will get redirected to SLF4J
  * </pre>
  * 
+ * <p>
+ * Please note that translating a java.util.logging event into SLF4J incurs the
+ * cost of constructing {@link LogRecord} instance regardless of whether the
+ * SLF4J logger is disabled for the given level. <b>Consequently, j.u.l. to
+ * SLF4J translation can seriously impact on the cost of disabled logging
+ * statements (60 fold increase) and a measurable impact on enabled log
+ * statements (20% overall increase). </b>
+ * </p>
+ * 
+ * <p>
+ * If application performance is a concern, then use of SLF4JBridgeHandler is
+ * appropriate only if few j.u.l. logging statements are in play.
+ * 
  * @author Christian Stein
  * @author Joern Huxhorn
  * @author Ceki G&uuml;lc&uuml;
diff --git a/jul-to-slf4j/src/test/java/org/slf4j/bridge/SLF4JBridgeHandlerPerfTest.java b/jul-to-slf4j/src/test/java/org/slf4j/bridge/SLF4JBridgeHandlerPerfTest.java
index 0933696..ae7d25c 100644
--- a/jul-to-slf4j/src/test/java/org/slf4j/bridge/SLF4JBridgeHandlerPerfTest.java
+++ b/jul-to-slf4j/src/test/java/org/slf4j/bridge/SLF4JBridgeHandlerPerfTest.java
@@ -38,6 +38,10 @@ public class SLF4JBridgeHandlerPerfTest extends TestCase {
   static String LOGGER_NAME = "yay";
   static int RUN_LENGTH = 100*1000;
 
+
+  // set to false to test enabled logging performance
+  boolean disabledLogger = true;
+  
   FileAppender fileAppender; 
   org.apache.log4j.Logger log4jRoot;
   java.util.logging.Logger julRootLogger = LogManager.getLogManager()
@@ -95,15 +99,17 @@ public class SLF4JBridgeHandlerPerfTest extends TestCase {
   
   public void testPerf() {
     SLF4JBridgeHandler.install();
-    //log4jRoot.setLevel(org.apache.log4j.Level.ERROR);
-
+    
+    if(disabledLogger) {
+     log4jRoot.setLevel(org.apache.log4j.Level.ERROR);
+    }
     julLoggerLoop();
     double julAvg=julLoggerLoop();
-    System.out.println("Average cost per call (JUL->SLF4J->log4j):"+julAvg +" nanos");
+    System.out.println("Average cost per call (JUL->SLF4J->log4j): "+julAvg +" nanos");
      
     slf4jLoggerLoop();
     double slf4jAvg=slf4jLoggerLoop();
-    System.out.println("Average cost per call (SLF4J->log4j):"+slf4jAvg +" nanos");
+    System.out.println("Average cost per call (SLF4J->log4j): "+slf4jAvg +" nanos");
     System.out.println("Ratio "+(julAvg/slf4jAvg));
   }
 }
diff --git a/slf4j-site/src/site/pages/legacy.html b/slf4j-site/src/site/pages/legacy.html
index 327ab01..e729d82 100644
--- a/slf4j-site/src/site/pages/legacy.html
+++ b/slf4j-site/src/site/pages/legacy.html
@@ -193,14 +193,31 @@
     
     <p>The jul-to-slf4j module includes a jul handler, namely
     SLF4JBridgeHandler, that routes all incoming jul records to the
-    SLF4j API. See also <a
+    SLF4j API. Please see <a
     href="api/org/slf4j/bridge/SLF4JBridgeHandler.html">SLF4JBridgeHandler
-    javadocs</a>. Contrary to other bridging modules such as
-    jcl-over-slf4j and log4j-over-slf4j, which re-implement JCL and
-    respectively log4j, the jul-to-slf4j modules does not re-implement
-    the java.util.logging package because packages under the java.*
-    namespace cannot be replaced.
+    javadocs</a> for usage instructions. 
     </p>
+
+    <p>Contrary to other bridging modules such as jcl-over-slf4j and
+    log4j-over-slf4j, which re-implement JCL and respectively log4j,
+    the jul-to-slf4j modules does not re-implement the
+    java.util.logging package because packages under the java.*
+    namespace cannot be replaced. Instead, translates LogRecord into
+    their SLF4J equivalents.  Please note that translating
+    java.util.logging events into SLF4J incurs the cost of
+    constructing <a
+    href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/logging/LogRecord.html?is-external=true">LogRecord</a>
+    instance regardless of whether the SLF4J logger is disabled for
+    the given level or nor. <b>Consequently, j.u.l. to SLF4J translation
+    can seriously impact on the cost of disabled logging statements
+    (60 fold increase) and a measurable impact on enabled log
+    statements (20% overall increase).</b>
+    </p>
+
+    <p>If application performance is a concern, then use of
+    SLF4JBridgeHandler is appropriate only if few j.u.l. logging
+    statements are in play. </p>
+   
     
     <h4>jul-to-slf4j.jar and slf4j-jdk14.jar cannot be present
     simultaneously
@@ -213,7 +230,7 @@
     route jul records to SLF4J. Thus, if both jar are present
     simultaneously (and SLF4JBridgeHandler is installed), slf4j calls
     will be delegated to jul and jul records will be routed to SLF4J,
-    resulting in an endless recursion.
+    resulting in an endless loop.
     </p> 
     
 

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

Summary of changes:
 .gitignore                                         |    6 +++-
 .../java/org/slf4j/bridge/SLF4JBridgeHandler.java  |   13 ++++++++
 .../slf4j/bridge/SLF4JBridgeHandlerPerfTest.java   |   14 ++++++--
 slf4j-site/src/site/pages/legacy.html              |   31 +++++++++++++++----
 4 files changed, 52 insertions(+), 12 deletions(-)


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



More information about the slf4j-dev mailing list