You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by gg...@apache.org on 2013/07/09 17:45:13 UTC

svn commit: r1501345 - /logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/AbstractAppender.java

Author: ggregory
Date: Tue Jul  9 15:45:13 2013
New Revision: 1501345

URL: http://svn.apache.org/r1501345
Log:
Sort members in AB order.

Modified:
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/AbstractAppender.java

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/AbstractAppender.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/AbstractAppender.java?rev=1501345&r1=1501344&r2=1501345&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/AbstractAppender.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/AbstractAppender.java Tue Jul  9 15:45:13 2013
@@ -40,18 +40,18 @@ public abstract class AbstractAppender<T
      */
     protected static final Logger LOGGER = StatusLogger.getLogger();
 
-    /**
-     * Appenders set this by calling super.start().
-     */
-    private boolean started = false;
+    private final boolean handleException;
+
+    private ErrorHandler handler = new DefaultErrorHandler(this);
 
     private final Layout<T> layout;
 
     private final String name;
 
-    private final boolean handleException;
-
-    private ErrorHandler handler = new DefaultErrorHandler(this);
+    /**
+     * Appenders set this by calling super.start().
+     */
+    private boolean started = false;
 
     /**
      * Constructor that defaults to suppressing exceptions.
@@ -80,6 +80,33 @@ public abstract class AbstractAppender<T
     }
 
     /**
+     * Handle an error with a message.
+     * @param msg The message.
+     */
+    public void error(final String msg) {
+        handler.error(msg);
+    }
+
+    /**
+     * Handle an error with a message, and exception and a logging event.
+     * @param msg The message.
+     * @param event The LogEvent.
+     * @param t The Throwable.
+     */
+    public void error(final String msg, final LogEvent event, final Throwable t) {
+        handler.error(msg, event, t);
+    }
+
+    /**
+     * Handle an error with a message and an exception.
+     * @param msg The message.
+     * @param t The Throwable.
+     */
+    public void error(final String msg, final Throwable t) {
+        handler.error(msg, t);
+    }
+
+    /**
      * Returns the ErrorHandler, if any.
      * @return The ErrorHandler.
      */
@@ -89,19 +116,12 @@ public abstract class AbstractAppender<T
     }
 
     /**
-     * The handler must be set before the appender is started.
-     * @param handler The ErrorHandler to use.
+     * Returns the Layout for the appender.
+     * @return The Layout used to format the event.
      */
     @Override
-    public void setHandler(final ErrorHandler handler) {
-        if (handler == null) {
-            LOGGER.error("The handler cannot be set to null");
-        }
-        if (isStarted()) {
-            LOGGER.error("The handler cannot be changed once the appender is started");
-            return;
-        }
-        this.handler = handler;
+    public Layout<T> getLayout() {
+        return layout;
     }
 
     /**
@@ -114,15 +134,6 @@ public abstract class AbstractAppender<T
     }
 
     /**
-     * Returns the Layout for the appender.
-     * @return The Layout used to format the event.
-     */
-    @Override
-    public Layout<T> getLayout() {
-        return layout;
-    }
-
-    /**
      * Some appenders need to propagate exceptions back to the application. When suppressException is false the
      * AppenderControl will allow the exception to percolate.
      * @return true if exceptions will be suppressed, false otherwise.
@@ -133,6 +144,31 @@ public abstract class AbstractAppender<T
     }
 
     /**
+     * Returns true if the Appender is started, false otherwise.
+     * @return true if the Appender is started, false otherwise.
+     */
+    @Override
+    public boolean isStarted() {
+        return started;
+    }
+
+    /**
+     * The handler must be set before the appender is started.
+     * @param handler The ErrorHandler to use.
+     */
+    @Override
+    public void setHandler(final ErrorHandler handler) {
+        if (handler == null) {
+            LOGGER.error("The handler cannot be set to null");
+        }
+        if (isStarted()) {
+            LOGGER.error("The handler cannot be changed once the appender is started");
+            return;
+        }
+        this.handler = handler;
+    }
+
+    /**
      * Start the Appender.
      */
     @Override
@@ -150,45 +186,9 @@ public abstract class AbstractAppender<T
         stopFilter();
     }
 
-    /**
-     * Returns true if the Appender is started, false otherwise.
-     * @return true if the Appender is started, false otherwise.
-     */
-    @Override
-    public boolean isStarted() {
-        return started;
-    }
-
     @Override
     public String toString() {
         return name;
     }
 
-    /**
-     * Handle an error with a message.
-     * @param msg The message.
-     */
-    public void error(final String msg) {
-        handler.error(msg);
-    }
-
-    /**
-     * Handle an error with a message and an exception.
-     * @param msg The message.
-     * @param t The Throwable.
-     */
-    public void error(final String msg, final Throwable t) {
-        handler.error(msg, t);
-    }
-
-    /**
-     * Handle an error with a message, and exception and a logging event.
-     * @param msg The message.
-     * @param event The LogEvent.
-     * @param t The Throwable.
-     */
-    public void error(final String msg, final LogEvent event, final Throwable t) {
-        handler.error(msg, event, t);
-    }
-
 }