[jboss-svn-commits] JBoss Common SVN: r3390 - 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 12:17:02 EDT 2009


Author: david.lloyd at jboss.com
Date: 2009-07-27 12:17:02 -0400 (Mon, 27 Jul 2009)
New Revision: 3390

Modified:
   jboss-logmanager/trunk/src/main/java/org/jboss/logmanager/Logger.java
Log:
More hooks for l8n/i18n-friendly consumers

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-23 15:49:24 UTC (rev 3389)
+++ jboss-logmanager/trunk/src/main/java/org/jboss/logmanager/Logger.java	2009-07-27 16:17:02 UTC (rev 3390)
@@ -96,6 +96,18 @@
     }
 
     /**
+     * Static logger factory method which returns a JBoss LogManager logger.
+     *
+     * @param name the logger name
+     * @param bundleName the bundle name
+     * @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);
+    }
+
+    /**
      * Construct a new instance of an actual logger.
      *
      * @param loggerNode the node in the named logger tree
@@ -736,6 +748,29 @@
     // alternate SPI hooks
 
     /**
+     * SPI interface method to log a message at a given level, with a specific resource bundle.
+     *
+     * @param fqcn the fully qualified class name of the first logger class
+     * @param level the level to log at
+     * @param message the message
+     * @param bundleName the resource bundle name
+     * @param style the message format style
+     * @param params the log parameters
+     * @param t the throwable, if any
+     */
+    public void log(final String fqcn, final Level level, final String message, final String bundleName, final ExtLogRecord.FormatStyle style, final Object[] params, final Throwable t) {
+        final int effectiveLevel = this.effectiveLevel;
+        if (level == null || fqcn == null || message == null || level.intValue() < effectiveLevel || effectiveLevel == OFF_INT) {
+            return;
+        }
+        final ExtLogRecord rec = new ExtLogRecord(level, message, style, fqcn);
+        rec.setResourceBundleName(bundleName);
+        rec.setParameters(params);
+        rec.setThrown(t);
+        logRaw(rec);
+    }
+
+    /**
      * SPI interface method to log a message at a given level.
      *
      * @param fqcn the fully qualified class name of the first logger class



More information about the jboss-svn-commits mailing list