You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by pm...@apache.org on 2017/07/29 14:13:25 UTC

svn commit: r1803370 - in /jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy: Daemon.java Proxy.java

Author: pmouawad
Date: Sat Jul 29 14:13:25 2017
New Revision: 1803370

URL: http://svn.apache.org/viewvc?rev=1803370&view=rev
Log:
Improve logging

Modified:
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Daemon.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Daemon.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Daemon.java?rev=1803370&r1=1803369&r2=1803370&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Daemon.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Daemon.java Sat Jul 29 14:13:25 2017
@@ -104,7 +104,7 @@ public class Daemon extends Thread imple
         this.target = target;
         this.daemonPort = port;
         this.proxyClass = proxyClass;
-        log.info("Creating Daemon Socket on port: " + daemonPort);
+        log.info("Creating Daemon Socket on port: {}", daemonPort);
         mainSocket = new ServerSocket(daemonPort);
         mainSocket.setSoTimeout(ACCEPT_TIMEOUT);
     }
@@ -145,10 +145,6 @@ public class Daemon extends Thread imple
         } finally {
             JOrphanUtils.closeQuietly(mainSocket);
         }
-
-        // Clear maps
-        pageEncodings = null;
-        formEncodings = null;
     }
 
     /**

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java?rev=1803370&r1=1803369&r2=1803370&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java Sat Jul 29 14:13:25 2017
@@ -167,7 +167,7 @@ public class Proxy extends Thread {
         HTTPSamplerBase sampler = null;
         final boolean isDebug = log.isDebugEnabled();
         if (isDebug) {
-            log.debug(port + "====================================================================");
+            log.debug("{} ====================================================================", port);
         }
         SamplerCreator samplerCreator = null;
         try {
@@ -175,18 +175,18 @@ public class Proxy extends Thread {
             byte[] ba = request.parse(new BufferedInputStream(clientSocket.getInputStream()));
             if (ba.length == 0) {
                 if (isDebug) {
-                    log.debug(port + "Empty request, ignored");
+                    log.debug("{} Empty request, ignored", port);
                 }
                 throw new JMeterException(); // hack to skip processing
             }
             if (isDebug) {
-                log.debug(port + "Initial request: " + new String(ba));
+                log.debug("{} Initial request: {}", port, new String(ba));
             }
             outStreamClient = clientSocket.getOutputStream();
 
             if ((request.getMethod().startsWith(HTTPConstants.CONNECT)) && (outStreamClient != null)) {
                 if (isDebug) {
-                    log.debug(port + "Method CONNECT => SSL");
+                    log.debug("{} Method CONNECT => SSL", port);
                 }
                 // write a OK response to browser, to engage SSL exchange
                 outStreamClient.write(("HTTP/1.0 200 OK\r\n\r\n").getBytes(SampleResult.DEFAULT_HTTP_ENCODING)); // $NON-NLS-1$
@@ -195,7 +195,7 @@ public class Proxy extends Thread {
                 String[] param = request.getUrl().split(":");  // $NON-NLS-1$
                 if (param.length == 2) {
                     if (isDebug) {
-                        log.debug(port + "Start to negotiate SSL connection, host: " + param[0]);
+                        log.debug("{} Start to negotiate SSL connection, host: {}", port ,param[0]);
                     }
                     clientSocket = startSSL(clientSocket, param[0]);
                 } else {
@@ -209,16 +209,18 @@ public class Proxy extends Thread {
                 } catch (IOException ioe) { // most likely this is because of a certificate error
                     // param.length is 2 here
                     final String url = " for '"+ param[0] +"'";
-                    log.warn(port + "Problem with SSL certificate"+url+"? Ensure browser is set to accept the JMeter proxy cert: " + ioe.getMessage());
+                    log.warn("{} Problem with SSL certificate for url {}? Ensure browser is set to accept the JMeter proxy cert: {}", 
+                            port, url,ioe.getMessage());
                     // won't work: writeErrorToClient(HttpReplyHdr.formInternalError());
                     result = generateErrorResult(result, request, ioe, "\n**ensure browser is set to accept the JMeter proxy certificate**"); // Generate result (if nec.) and populate it
                     throw new JMeterException(); // hack to skip processing
                 }
                 if (isDebug) {
-                    log.debug(port + "Reparse: " + new String(ba));
+                    log.debug("{} Reparse: ", port, new String(ba));
                 }
                 if (ba.length == 0) {
-                    log.warn(port + "Empty response to http over SSL. Probably waiting for user to authorize the certificate for " + request.getUrl());
+                    log.warn("{} Empty response to http over SSL. Probably waiting for user to authorize the certificate for {}",
+                                port, request.getUrl());
                     throw new JMeterException(); // hack to skip processing
                 }
             }
@@ -235,7 +237,7 @@ public class Proxy extends Thread {
 
             sampler.threadStarted(); // Needed for HTTPSampler2
             if (isDebug) {
-                log.debug(port + "Execute sample: " + sampler.getMethod() + " " + sampler.getUrl());
+                log.debug("{} Execute sample: {} and url {}",port, sampler.getMethod(), sampler.getUrl());
             }
             result = sampler.sample();