[jboss-svn-commits] JBoss Common SVN: r3392 - jboss-logmanager/trunk/src/main/java/org/jboss/logmanager.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Jul 27 19:05:41 EDT 2009


Author: david.lloyd at jboss.com
Date: 2009-07-27 19:05:41 -0400 (Mon, 27 Jul 2009)
New Revision: 3392

Modified:
   jboss-logmanager/trunk/src/main/java/org/jboss/logmanager/Logger.java
Log:
Make the error message nicer for when the logmanager is not properly installed

Modified: jboss-logmanager/trunk/src/main/java/org/jboss/logmanager/Logger.java
===================================================================
--- jboss-logmanager/trunk/src/main/java/org/jboss/logmanager/Logger.java	2009-07-27 20:16:30 UTC (rev 3391)
+++ jboss-logmanager/trunk/src/main/java/org/jboss/logmanager/Logger.java	2009-07-27 23:05:41 UTC (rev 3392)
@@ -91,8 +91,12 @@
      * @return the logger
      */
     public static Logger getLogger(final String name) {
-        // call through j.u.l.Logger so that primordial configuration is set up
-        return (Logger) java.util.logging.Logger.getLogger(name);
+        try {
+            // call through j.u.l.Logger so that primordial configuration is set up
+            return (Logger) java.util.logging.Logger.getLogger(name);
+        } catch (ClassCastException e) {
+            throw new IllegalStateException("The LogManager was not properly installed (you must set the \"java.util.logging.manager\" system property to \"" + LogManager.class.getName() + "\")");
+        }
     }
 
     /**
@@ -103,8 +107,12 @@
      * @return the logger
      */
     public static Logger getLogger(final String name, final String bundleName) {
-        // call through j.u.l.Logger so that primordial configuration is set up
-        return (Logger) java.util.logging.Logger.getLogger(name, bundleName);
+        try {
+            // call through j.u.l.Logger so that primordial configuration is set up
+            return (Logger) java.util.logging.Logger.getLogger(name, bundleName);
+        } catch (ClassCastException e) {
+            throw new IllegalStateException("The LogManager was not properly installed (you must set the \"java.util.logging.manager\" system property to \"" + LogManager.class.getName() + "\")");
+        }
     }
 
     /**



More information about the jboss-svn-commits mailing list