jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fschumac...@apache.org
Subject svn commit: r1852788 - /jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/HttpMirrorServer.java
Date Sat, 02 Feb 2019 11:13:21 GMT
Author: fschumacher
Date: Sat Feb  2 11:13:20 2019
New Revision: 1852788

URL: http://svn.apache.org/viewvc?rev=1852788&view=rev
Log:
Use string formats for log messages and make warning for bind exception more explicit.

Modified:
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/HttpMirrorServer.java

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/HttpMirrorServer.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/HttpMirrorServer.java?rev=1852788&r1=1852787&r2=1852788&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/HttpMirrorServer.java
(original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/HttpMirrorServer.java
Sat Feb  2 11:13:20 2019
@@ -19,6 +19,7 @@
 package org.apache.jmeter.protocol.http.control;
 
 import java.io.InterruptedIOException;
+import java.net.BindException;
 import java.net.ServerSocket;
 import java.net.Socket;
 import java.util.List;
@@ -150,7 +151,7 @@ public class HttpMirrorServer extends Th
             threadPoolExecutor.setRejectedExecutionHandler(new ThreadPoolExecutor.DiscardPolicy());
         }
         try {
-            getLogger().info("Creating HttpMirror ... on port " + daemonPort);
+            getLogger().info("Creating HttpMirror ... on port {}", Integer.valueOf(daemonPort));
             mainSocket = new ServerSocket(daemonPort);
             mainSocket.setSoTimeout(ACCEPT_TIMEOUT);
             getLogger().info("HttpMirror up and running!");
@@ -177,6 +178,10 @@ public class HttpMirrorServer extends Th
                 }
             }
             getLogger().info("HttpMirror Server stopped");
+        } catch (BindException e) {
+            except = e;
+            getLogger().warn("Could not bind HttpMirror to port {}. Maybe there is already
a HttpMirror running?",
+                    Integer.valueOf(daemonPort));
         } catch (Exception e) {
             except = e;
             getLogger().warn("HttpMirror Server stopped", e);
@@ -249,18 +254,18 @@ public class HttpMirrorServer extends Th
                         if (name.startsWith("jmeter") || name.startsWith("jorphan")) {
                             loggerName = "org.apache." + name;// $NON-NLS-1$
                         }
-                        getLogger().info("Setting log level to " + value + " for " + loggerName);//
$NON-NLS-1$ // $NON-NLS-2$
+                        getLogger().info("Setting log level to '{}' for '{}'.", value, loggerName);//
$NON-NLS-1$ // $NON-NLS-2$
                         Configurator.setAllLevels(loggerName, logLevel);
                     } else {
-                        getLogger().warn("Invalid log level, '" + value + "' for '" + name
+ "'.");// $NON-NLS-1$ // $NON-NLS-2$
+                        getLogger().warn("Invalid log level, '{}' for '{}'.", value, name);//
$NON-NLS-1$ // $NON-NLS-2$
                     }
                 } else { // Set root level
                     final Level logLevel = Level.getLevel(name);
                     if (logLevel != null) {
-                        getLogger().info("Setting root log level to " + name);// $NON-NLS-1$
+                        getLogger().info("Setting root log level to '{}'", name);// $NON-NLS-1$
                         Configurator.setRootLevel(logLevel);
                     } else {
-                        getLogger().warn("Invalid log level, '" + name + "' for the root
logger.");// $NON-NLS-1$ // $NON-NLS-2$
+                        getLogger().warn("Invalid log level, '{}' for the root logger.",
name);// $NON-NLS-1$ // $NON-NLS-2$
                     }
                 }
                 break;



Mime
View raw message