Java HttpClient - reducing debug output
<p>I need to load test an application we've been developing, but our console log is constantly spammed with output. From earlier experience, I've learnt that <code>System.out.println( )</code> is a relatively expensive operation, so I would like to reduce the printing to a minimum.</p>

<p>The printing only occurs when the application attempts a Http-post, but we do 100s of them per second. We use Apache's HttpClient 4.5.2 and HttpCore 4.4.5. The application runs on Tomcat 7.</p>

<p>I've tried a lot of different solutions: removing the Tomcat valves, setting the Tomcat logging level, setting -Djavax.net.debug=none, but nothing seems to remove this. Does anyone know what causes these outputs, and how do I turn them off?</p>

<p>The debug output is shown bellow:</p>

<pre><code>2016-10-11 15:24:42,942 DEBUG [http-bio-8080-exec-3] Connection request: [route: {}-&gt;http://localhost:8080][total kept alive: 0; route allocated: 0 of 200; total allocated: 0 of 200]
2016-10-11 15:24:42,956 DEBUG [http-bio-8080-exec-3] Connection leased: [id: 0][route: {}-&gt;http://localhost:8080][total kept alive: 0; route allocated: 1 of 200; total allocated: 1 of 200]
2016-10-11 15:24:42,958 DEBUG [http-bio-8080-exec-3] Connecting to localhost:8080
2016-10-11 15:24:42,978 DEBUG [http-bio-8080-exec-3] CookieSpec selected: best-match
2016-10-11 15:24:42,994 DEBUG [http-bio-8080-exec-3] Auth cache not set in the context
2016-10-11 15:24:42,995 DEBUG [http-bio-8080-exec-3] Target auth state: UNCHALLENGED
2016-10-11 15:24:42,996 DEBUG [http-bio-8080-exec-3] Proxy auth state: UNCHALLENGED
2016-10-11 15:24:42,996 DEBUG [http-bio-8080-exec-3] Attempt 1 to execute request
2016-10-11 15:24:42,997 DEBUG [http-bio-8080-exec-3] Sending request: POST /XtService/account/getbalance HTTP/1.1
2016-10-11 15:24:42,997 DEBUG [http-bio-8080-exec-3] &gt;&gt; "POST /XtService/account/getbalance HTTP/1.1[\r][\n]"
2016-10-11 15:24:42,999 DEBUG [http-bio-8080-exec-3] &gt;&gt; "Content-Length: 48[\r][\n]"
2016-10-11 15:24:42,999 DEBUG [http-bio-8080-exec-3] &gt;&gt; "Content-Type: application/x-www-form-urlencoded; charset=UTF-8[\r][\n]"
2016-10-11 15:24:43,000 DEBUG [http-bio-8080-exec-3] &gt;&gt; "Host: localhost:8080[\r][\n]"
2016-10-11 15:24:43,000 DEBUG [http-bio-8080-exec-3] &gt;&gt; "Connection: Keep-Alive[\r][\n]"
2016-10-11 15:24:43,000 DEBUG [http-bio-8080-exec-3] &gt;&gt; "User-Agent: Apache-HttpClient/4.2 (java 1.5)[\r][\n]"
2016-10-11 15:24:43,000 DEBUG [http-bio-8080-exec-3] &gt;&gt; "[\r][\n]"
2016-10-11 15:24:43,001 DEBUG [http-bio-8080-exec-3] &gt;&gt; POST /XtService/account/getbalance HTTP/1.1
2016-10-11 15:24:43,001 DEBUG [http-bio-8080-exec-3] &gt;&gt; Content-Length: 48
2016-10-11 15:24:43,001 DEBUG [http-bio-8080-exec-3] &gt;&gt; Content-Type: application/x-www-form-urlencoded; charset=UTF-8
2016-10-11 15:24:43,001 DEBUG [http-bio-8080-exec-3] &gt;&gt; Host: localhost:8080
2016-10-11 15:24:43,001 DEBUG [http-bio-8080-exec-3] &gt;&gt; Connection: Keep-Alive
2016-10-11 15:24:43,001 DEBUG [http-bio-8080-exec-3] &gt;&gt; User-Agent: Apache-HttpClient/4.2 (java 1.5)
2016-10-11 15:24:43,001 DEBUG [http-bio-8080-exec-3] &gt;&gt; "categoryid=2"
2016-10-11 15:24:43,256 DEBUG [http-bio-8080-exec-3] &lt;&lt; "HTTP/1.1 200 OK[\r][\n]"
2016-10-11 15:24:43,259 DEBUG [http-bio-8080-exec-3] &lt;&lt; "Server: Apache-Coyote/1.1[\r][\n]"
2016-10-11 15:24:43,260 DEBUG [http-bio-8080-exec-3] &lt;&lt; "Pragma: no-cache[\r][\n]"
2016-10-11 15:24:43,260 DEBUG [http-bio-8080-exec-3] &lt;&lt; "Cache-Control: no-cache[\r][\n]"
2016-10-11 15:24:43,260 DEBUG [http-bio-8080-exec-3] &lt;&lt; "Expires: Thu, 01 Jan 1970 00:00:00 GMT[\r][\n]"
2016-10-11 15:24:43,261 DEBUG [http-bio-8080-exec-3] &lt;&lt; "Content-Type: application/json;charset=utf-8[\r][\n]"
2016-10-11 15:24:43,261 DEBUG [http-bio-8080-exec-3] &lt;&lt; "Content-Length: 83[\r][\n]"
2016-10-11 15:24:43,261 DEBUG [http-bio-8080-exec-3] &lt;&lt; "Date: Tue, 11 Oct 2016 13:24:43 GMT[\r][\n]"
2016-10-11 15:24:43,261 DEBUG [http-bio-8080-exec-3] &lt;&lt; "[\r][\n]"
2016-10-11 15:24:43,262 DEBUG [http-bio-8080-exec-3] Receiving response: HTTP/1.1 200 OK
2016-10-11 15:24:43,262 DEBUG [http-bio-8080-exec-3] &lt;&lt; HTTP/1.1 200 OK
2016-10-11 15:24:43,263 DEBUG [http-bio-8080-exec-3] &lt;&lt; Server: Apache-Coyote/1.1
2016-10-11 15:24:43,263 DEBUG [http-bio-8080-exec-3] &lt;&lt; Pragma: no-cache
2016-10-11 15:24:43,263 DEBUG [http-bio-8080-exec-3] &lt;&lt; Cache-Control: no-cache
2016-10-11 15:24:43,263 DEBUG [http-bio-8080-exec-3] &lt;&lt; Expires: Thu, 01 Jan 1970 00:00:00 GMT
2016-10-11 15:24:43,263 DEBUG [http-bio-8080-exec-3] &lt;&lt; Content-Type: application/json;charset=utf-8
2016-10-11 15:24:43,263 DEBUG [http-bio-8080-exec-3] &lt;&lt; Content-Length: 83
2016-10-11 15:24:43,263 DEBUG [http-bio-8080-exec-3] &lt;&lt; Date: Tue, 11 Oct 2016 13:24:43 GMT
2016-10-11 15:24:43,265 DEBUG [http-bio-8080-exec-3] Connection can be kept alive for 10000 MILLISECONDS
2016-10-11 15:24:43,274 DEBUG [http-bio-8080-exec-3] &lt;&lt; "{"status":1,"data":{"RESERVED":569.81}}"
2016-10-11 15:24:43,275 DEBUG [http-bio-8080-exec-3] Connection [id: 0][route: {}-&gt;http://localhost:8080] can be kept alive for 10000 MILLISECONDS
2016-10-11 15:24:43,275 DEBUG [http-bio-8080-exec-3] Connection released: [id: 0][route: {}-&gt;http://localhost:8080][total kept alive: 1; route allocated: 1 of 200; total allocated: 1 of 200]
</code></pre>