logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1501415 - /logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/FailoverAppender.java
Date Tue, 09 Jul 2013 18:12:53 GMT
Author: ggregory
Date: Tue Jul  9 18:12:52 2013
New Revision: 1501415

URL: http://svn.apache.org/r1501415
Log:
Simplify config processing.

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

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/FailoverAppender.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/FailoverAppender.java?rev=1501415&r1=1501414&r2=1501415&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/FailoverAppender.java
(original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/FailoverAppender.java
Tue Jul  9 18:12:52 2013
@@ -33,7 +33,6 @@ import org.apache.logging.log4j.core.con
 import org.apache.logging.log4j.core.config.plugins.PluginElement;
 import org.apache.logging.log4j.core.config.plugins.PluginFactory;
 import org.apache.logging.log4j.core.helpers.Constants;
-import org.apache.logging.log4j.core.helpers.Strings;
 
 /**
  * The FailoverAppender will capture exceptions in an Appender and then route the event
@@ -45,7 +44,7 @@ import org.apache.logging.log4j.core.hel
 @Plugin(name = "Failover", category = "Core", elementType = "appender", printObject = true)
 public final class FailoverAppender<T extends Serializable> extends AbstractAppender<T>
{
 
-    private static final int DEFAULT_INTERVAL_MILLIS = 60 * Constants.MILLIS_IN_SECONDS;
+    private static final int DEFAULT_INTERVAL_SECONDS = 60;
 
     private final String primaryRef;
 
@@ -206,22 +205,13 @@ public final class FailoverAppender<T ex
             return null;
         }
 
+        final int seconds = parseInt(intervalSeconds, DEFAULT_INTERVAL_SECONDS);
         int retryIntervalMillis;
-        if (Strings.isEmpty(intervalSeconds)) {
-            retryIntervalMillis = DEFAULT_INTERVAL_MILLIS;
+        if (seconds >= 0) {
+            retryIntervalMillis = seconds * Constants.MILLIS_IN_SECONDS;
         } else {
-            try {
-                final int seconds = Integer.parseInt(intervalSeconds);
-                if (seconds >= 0) {
-                    retryIntervalMillis = seconds * Constants.MILLIS_IN_SECONDS;
-                } else {
-                    LOGGER.warn("Interval " + intervalSeconds + " is less than zero. Using
default");
-                    retryIntervalMillis = DEFAULT_INTERVAL_MILLIS;
-                }
-            } catch (final NumberFormatException nfe) {
-                LOGGER.error("Interval " + intervalSeconds + " is non-numeric. Using default");
-                retryIntervalMillis = DEFAULT_INTERVAL_MILLIS;
-            }
+            LOGGER.warn("Interval " + intervalSeconds + " is less than zero. Using default");
+            retryIntervalMillis = DEFAULT_INTERVAL_SECONDS * Constants.MILLIS_IN_SECONDS;
         }
 
         final boolean handleExceptions = suppress == null ? true : Boolean.valueOf(suppress);



Mime
View raw message