[logback-dev] svn commit: r1472 - logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/joran/action

noreply.seb at qos.ch noreply.seb at qos.ch
Wed Mar 28 15:16:57 CEST 2007


Author: seb
Date: Wed Mar 28 15:16:57 2007
New Revision: 1472

Modified:
   logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/ConsolePluginAction.java

Log:
Updated ConsolePluginAction.java to set a default port

Modified: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/ConsolePluginAction.java
==============================================================================
--- logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/ConsolePluginAction.java	(original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/joran/action/ConsolePluginAction.java	Wed Mar 28 15:16:57 2007
@@ -12,22 +12,23 @@
 public class ConsolePluginAction extends Action {
 
   private static final String PORT_ATTR = "port";
+  private static final Integer DEFAULT_PORT = 4321;
 
   @Override
   public void begin(InterpretationContext ec, String name, Attributes attributes)
       throws ActionException {
     String portStr = attributes.getValue(PORT_ATTR);
-
-    if (portStr == null) {
-      addError("The ConsolePlugin configuration requires a port attribute.");
-    }
-
     Integer port = null;
-    try {
-      port = Integer.valueOf(portStr);
-    } catch (NumberFormatException ex) {
-      addError("Port " + portStr
-          + " in ConsolePlugin config is not a correct number");
+    
+    if (portStr == null) {
+      port = DEFAULT_PORT;
+    } else {
+      try {
+        port = Integer.valueOf(portStr);
+      } catch (NumberFormatException ex) {
+        addError("Port " + portStr
+            + " in ConsolePlugin config is not a correct number");
+      }
     }
 
     LoggerContext lc = (LoggerContext)ec.getContext();



More information about the logback-dev mailing list