Checkstyle: DeclarationOrder, LineLength, trailing spaces. IDE
autoformatted.


Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/cc844b29
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/cc844b29
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/cc844b29

Branch: refs/heads/LOG4J2-1136
Commit: cc844b29d9304de6f925c42b419589ed555872de
Parents: b2e612f
Author: rpopma <[email protected]>
Authored: Thu Sep 24 09:18:50 2015 +0200
Committer: Ralph Goers <[email protected]>
Committed: Sun Sep 27 10:47:28 2015 -0700

----------------------------------------------------------------------
 .../logging/log4j/spi/AbstractLogger.java       | 59 ++++++++++----------
 1 file changed, 28 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/cc844b29/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java
----------------------------------------------------------------------
diff --git 
a/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java 
b/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java
index a5b5fdd..0d9b642 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java
@@ -35,8 +35,6 @@ import org.apache.logging.log4j.util.Supplier;
  */
 public abstract class AbstractLogger implements ExtendedLogger, Serializable {
 
-    private static final long serialVersionUID = 2L;
-
     /**
      * Marker for flow tracing.
      */
@@ -72,39 +70,13 @@ public abstract class AbstractLogger implements 
ExtendedLogger, Serializable {
      */
     public static final Class<? extends MessageFactory> 
DEFAULT_MESSAGE_FACTORY_CLASS = ParameterizedMessageFactory.class;
 
-    private static final String FQCN = AbstractLogger.class.getName();
+    private static final long serialVersionUID = 2L;
 
+    private static final String FQCN = AbstractLogger.class.getName();
     private static final String THROWING = "throwing";
-
     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 ExtendedLogger 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;
 
     /**
@@ -136,6 +108,31 @@ public abstract class AbstractLogger implements 
ExtendedLogger, Serializable {
         this.messageFactory = messageFactory == null ? 
createDefaultMessageFactory() : messageFactory;
     }
 
+    /**
+     * 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 ExtendedLogger 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());
+        }
+    }
+
     @Override
     public void catching(final Level level, final Throwable t) {
         catching(FQCN, level, t);
@@ -940,7 +937,7 @@ public abstract class AbstractLogger implements 
ExtendedLogger, Serializable {
     }
 
     @Override
-    public void logIfEnabled(final String fqcn, final Level level, final 
Marker marker, 
+    public void logIfEnabled(final String fqcn, final Level level, final 
Marker marker,
             final MessageSupplier msgSupplier, final Throwable t) {
         if (isEnabled(level, marker, msgSupplier, t)) {
             logMessage(fqcn, level, marker, msgSupplier, t);

Reply via email to