logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1559414 - /logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java
Date Sat, 18 Jan 2014 20:52:26 GMT
Author: ggregory
Date: Sat Jan 18 20:52:26 2014
New Revision: 1559414

URL: http://svn.apache.org/r1559414
Log:
Sort members.

Modified:
    logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java

Modified: logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java?rev=1559414&r1=1559413&r2=1559414&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java
(original)
+++ logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java
Sat Jan 18 20:52:26 2014
@@ -78,6 +78,35 @@ public abstract class AbstractLogger imp
 
     private static final String CATCHING = "catching";
 
+    /**
+     * Checks that the message factory a logger was created with is the same as the given
messageFactory. If they are
+     * different log a warning to the {@linkplain StatusLogger}. A null MessageFactory translates
to the default
+     * MessageFactory {@link #DEFAULT_MESSAGE_FACTORY_CLASS}.
+     *
+     * @param logger
+     *            The logger to check
+     * @param messageFactory
+     *            The message factory to check.
+     */
+    public static void checkMessageFactory(final Logger logger, final MessageFactory messageFactory)
{
+        final String name = logger.getName();
+        final MessageFactory loggerMessageFactory = logger.getMessageFactory();
+        if (messageFactory != null && !loggerMessageFactory.equals(messageFactory))
{
+            StatusLogger
+                .getLogger()
+                .warn("The Logger {} was created with the message factory {} and is now requested
with the " +
+                    "message factory {}, which may create log events with unexpected formatting.",
+                    name, loggerMessageFactory, messageFactory);
+        } else if (messageFactory == null
+            && !loggerMessageFactory.getClass().equals(DEFAULT_MESSAGE_FACTORY_CLASS))
{
+            StatusLogger
+                .getLogger()
+                .warn("The Logger {} was created with the message factory {} and is now requested
with a null " +
+                    "message factory (defaults to {}), which may create log events with unexpected
formatting.",
+                    name, loggerMessageFactory, DEFAULT_MESSAGE_FACTORY_CLASS.getName());
+        }
+    }
+
     private final String name;
 
     private final MessageFactory messageFactory;
@@ -112,35 +141,6 @@ public abstract class AbstractLogger imp
     }
 
     /**
-     * Checks that the message factory a logger was created with is the same as the given
messageFactory. If they are
-     * different log a warning to the {@linkplain StatusLogger}. A null MessageFactory translates
to the default
-     * MessageFactory {@link #DEFAULT_MESSAGE_FACTORY_CLASS}.
-     *
-     * @param logger
-     *            The logger to check
-     * @param messageFactory
-     *            The message factory to check.
-     */
-    public static void checkMessageFactory(final Logger logger, final MessageFactory messageFactory)
{
-        final String name = logger.getName();
-        final MessageFactory loggerMessageFactory = logger.getMessageFactory();
-        if (messageFactory != null && !loggerMessageFactory.equals(messageFactory))
{
-            StatusLogger
-                .getLogger()
-                .warn("The Logger {} was created with the message factory {} and is now requested
with the " +
-                    "message factory {}, which may create log events with unexpected formatting.",
-                    name, loggerMessageFactory, messageFactory);
-        } else if (messageFactory == null
-            && !loggerMessageFactory.getClass().equals(DEFAULT_MESSAGE_FACTORY_CLASS))
{
-            StatusLogger
-                .getLogger()
-                .warn("The Logger {} was created with the message factory {} and is now requested
with a null " +
-                    "message factory (defaults to {}), which may create log events with unexpected
formatting.",
-                    name, loggerMessageFactory, DEFAULT_MESSAGE_FACTORY_CLASS.getName());
-        }
-    }
-
-    /**
      * Logs a Throwable that has been caught.
      *
      * @param level The logging Level.
@@ -152,16 +152,6 @@ public abstract class AbstractLogger imp
     }
 
     /**
-     * Logs a Throwable at the {@link Level#ERROR ERROR} level..
-     *
-     * @param t The Throwable.
-     */
-    @Override
-    public void catching(final Throwable t) {
-        catching(FQCN, Level.ERROR, t);
-    }
-
-    /**
      * Logs a Throwable that has been caught with location information.
      *
      * @param fqcn The fully qualified class name of the <b>caller</b>.
@@ -174,6 +164,16 @@ public abstract class AbstractLogger imp
         }
     }
 
+    /**
+     * Logs a Throwable at the {@link Level#ERROR ERROR} level..
+     *
+     * @param t The Throwable.
+     */
+    @Override
+    public void catching(final Throwable t) {
+        catching(FQCN, Level.ERROR, t);
+    }
+
     private MessageFactory createDefaultMessageFactory() {
         try {
             return DEFAULT_MESSAGE_FACTORY_CLASS.newInstance();
@@ -1102,6 +1102,11 @@ public abstract class AbstractLogger imp
         return isEnabled(level, null, (Object) null, null);
     }
 
+    @Override
+    public boolean isEnabled(final Level level, final Marker marker) {
+        return isEnabled(level, marker, (Object) null, null);
+    }
+
     /**
      * Determine if logging is enabled.
      * @param level The logging Level to check.
@@ -1230,6 +1235,7 @@ public abstract class AbstractLogger imp
         return isEnabled(Level.TRACE, null, (Object) null, null);
     }
 
+
     /**
      * Checks whether this Logger is enabled for the TRACE  Level.
      *
@@ -1242,7 +1248,6 @@ public abstract class AbstractLogger imp
         return isEnabled(Level.TRACE, marker, (Object) null, null);
     }
 
-
     /**
      * Checks whether this Logger is enabled for the WARN Level.
      *
@@ -1266,11 +1271,6 @@ public abstract class AbstractLogger imp
         return isEnabled(Level.WARN, marker, (Object) null, null);
     }
 
-    @Override
-    public boolean isEnabled(final Level level, final Marker marker) {
-        return isEnabled(level, marker, (Object) null, null);
-    }
-
     /**
      * Logs a message with the specific Marker at the given level.
      *
@@ -1476,46 +1476,46 @@ public abstract class AbstractLogger imp
     }
 
     /**
+     * Logs a message with location information.
+     *
+     * @param marker The Marker
+     * @param fqcn   The fully qualified class name of the <b>caller</b>
+     * @param level  The logging level
+     * @param data   The Message.
+     * @param t      A Throwable or null.
+     */
+    public abstract void log(Marker marker, String fqcn, Level level, Message data, Throwable
t);
+
+    /**
      * Logs a formatted message using the specified format string and arguments.
      * @param level The logging Level.
+     * @param marker the marker data specific to this log statement.
      * @param format The format String.
      * @param params Arguments specified by the format.
      */
     @Override
-    public void printf(Level level, String format, Object... params) {
-        if (isEnabled(level, null, format, params)) {
+    public void printf(Level level, Marker marker, String format, Object... params) {
+        if (isEnabled(level, marker, format, params)) {
             Message msg = new StringFormattedMessage(format, params);
-            log(null, FQCN, level, msg, msg.getThrowable());
+            log(marker, FQCN, level, msg, msg.getThrowable());
         }
     }
 
     /**
      * Logs a formatted message using the specified format string and arguments.
      * @param level The logging Level.
-     * @param marker the marker data specific to this log statement.
      * @param format The format String.
      * @param params Arguments specified by the format.
      */
     @Override
-    public void printf(Level level, Marker marker, String format, Object... params) {
-        if (isEnabled(level, marker, format, params)) {
+    public void printf(Level level, String format, Object... params) {
+        if (isEnabled(level, null, format, params)) {
             Message msg = new StringFormattedMessage(format, params);
-            log(marker, FQCN, level, msg, msg.getThrowable());
+            log(null, FQCN, level, msg, msg.getThrowable());
         }
     }
 
     /**
-     * Logs a message with location information.
-     *
-     * @param marker The Marker
-     * @param fqcn   The fully qualified class name of the <b>caller</b>
-     * @param level  The logging level
-     * @param data   The Message.
-     * @param t      A Throwable or null.
-     */
-    public abstract void log(Marker marker, String fqcn, Level level, Message data, Throwable
t);
-
-    /**
      * Logs a Throwable to be thrown.
      *
      * @param <T> the type of the Throwable.
@@ -1529,18 +1529,6 @@ public abstract class AbstractLogger imp
     }
 
     /**
-     * Logs a Throwable to be thrown.
-     *
-     * @param <T> the type of the Throwable.
-     * @param t The Throwable.
-     * @return the Throwable.
-     */
-    @Override
-    public <T extends Throwable> T throwing(final T t) {
-        return throwing(FQCN, Level.ERROR, t);
-    }
-
-    /**
      * Logs a Throwable to be thrown with location information.
      *
      * @param fqcn The fully qualified class name of the <b>caller</b>.
@@ -1556,6 +1544,18 @@ public abstract class AbstractLogger imp
         return t;
     }
 
+    /**
+     * Logs a Throwable to be thrown.
+     *
+     * @param <T> the type of the Throwable.
+     * @param t The Throwable.
+     * @return the Throwable.
+     */
+    @Override
+    public <T extends Throwable> T throwing(final T t) {
+        return throwing(FQCN, Level.ERROR, t);
+    }
+
     private Message toExitMsg(final Object result) {
         if (result == null) {
             return messageFactory.newMessage("exit");



Mime
View raw message