jspwiki-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jalka...@apache.org
Subject svn commit: r797650 - /incubator/jspwiki/trunk/src/java/org/apache/wiki/log/LoggerFactory.java
Date Fri, 24 Jul 2009 20:59:06 GMT
Author: jalkanen
Date: Fri Jul 24 20:59:06 2009
New Revision: 797650

URL: http://svn.apache.org/viewvc?rev=797650&view=rev
Log:
No longer fails if the bridge classes are missing.

Modified:
    incubator/jspwiki/trunk/src/java/org/apache/wiki/log/LoggerFactory.java

Modified: incubator/jspwiki/trunk/src/java/org/apache/wiki/log/LoggerFactory.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/log/LoggerFactory.java?rev=797650&r1=797649&r2=797650&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/log/LoggerFactory.java (original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/log/LoggerFactory.java Fri Jul 24 20:59:06
2009
@@ -32,7 +32,6 @@
 import org.apache.wiki.Release;
 import org.apache.wiki.WikiEngine;
 import org.apache.wiki.parser.MarkupParser;
-import org.slf4j.bridge.SLF4JBridgeHandler;
 
 
 /**
@@ -67,9 +66,30 @@
     
     private static String c_wikiName = null;
 
+    /**
+     *  Attempt to install the SLF4J bridge handlers.  However, since those
+     *  classes might not be available for some reason or the other, we call
+     *  the initialization through Reflection to avoid really hard-to-debug
+     *  problems during servlet container startup.
+     */
     static
     {
-        SLF4JBridgeHandler.install();
+        try
+        {
+            Class<?> bridge = Class.forName( "org.slf4j.bridge.SLF4JBridgeHandler"
);
+            
+            Method m = bridge.getMethod("install");
+            
+            m.invoke(null);
+        }
+        catch( Exception e ) 
+        {
+            System.out.println("No SLF4J bridge handler classes located; continuing anyway.
" +
+                               "In practice this means that only JSPWiki logs entries will
be available " +
+                               "in the JSPWiki log files. If you want to have the logs also
from " +
+                               "any of the additional libraries, you should install the java.util.logging
" +
+                               "and commons logging bridge files.");
+        }
     }
 
     /**



Mime
View raw message