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

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Jun 5 14:08:42 EDT 2009


Author: david.lloyd at jboss.com
Date: 2009-06-05 14:08:42 -0400 (Fri, 05 Jun 2009)
New Revision: 3230

Modified:
   jboss-logmanager/trunk/src/main/java/org/jboss/logmanager/Logger.java
Log:
NPE-resistant level checks and additional SPI hook

Modified: jboss-logmanager/trunk/src/main/java/org/jboss/logmanager/Logger.java
===================================================================
--- jboss-logmanager/trunk/src/main/java/org/jboss/logmanager/Logger.java	2009-06-05 15:01:29 UTC (rev 3229)
+++ jboss-logmanager/trunk/src/main/java/org/jboss/logmanager/Logger.java	2009-06-05 18:08:42 UTC (rev 3230)
@@ -582,18 +582,34 @@
      * @param fqcn the fully qualified class name of the first logger class
      * @param level the level to log at
      * @param message the message
+     * @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 Throwable t) {
+    public void log(final String fqcn, final Level level, final String message, final ExtLogRecord.FormatStyle style, final Object[] params, final Throwable t) {
         final int effectiveLevel = this.effectiveLevel;
-        if (level.intValue() >= effectiveLevel && effectiveLevel != OFF_INT) {
-            final ExtLogRecord rec = new ExtLogRecord(level, message, fqcn);
-            rec.setThrown(t);
-            logRaw(rec);
+        if (level == null || fqcn == null || message == null || level.intValue() < effectiveLevel || effectiveLevel == OFF_INT) {
+            return;
         }
+        final ExtLogRecord rec = new ExtLogRecord(level, message, style, fqcn);
+        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
+     * @param level the level to log at
+     * @param message the message
+     * @param t the throwable, if any
+     */
+    public void log(final String fqcn, final Level level, final String message, final Throwable t) {
+        log(fqcn, level, message, ExtLogRecord.FormatStyle.MESSAGE_FORMAT, null, t);
+    }
+
+    /**
      * Do the logging with no level checks (they've already been done).
      *
      * @param record the extended log record




More information about the jboss-svn-commits mailing list