Note that there are some explanatory texts on larger screens.

plurals
  1. PODisable HttpClient logging
    text
    copied!<p>I am using commons-httpclient 3.1 in an integration test suite. The default logging for HttpClient is extremely noisy and I can't seem to turn it off. I've tried following the instructions <a href="http://hc.apache.org/httpcomponents-client-ga/logging.html">here</a> but none of them make any difference. </p> <p>Mostly I just need to make the org.apache.http.wire logger shut up. Part of the problem is that I don't know what type of logger HttpClient is trying to use and most of the problem is I've never used this library before. I tried creating a log4j.properties file and dropping it in my test/resources folder, modifying the master logging.properties file in jre/lib, and sending in the various logging options to Maven as specified on the <a href="http://hc.apache.org/httpcomponents-client-ga/logging.html">logging page</a>, and none of them make any difference.</p> <p>Any help is appreciated...this is driving me nuts.</p> <p><strong>UPDATE:</strong> A correction: it appears the output in question is actually originating through jwebunit's usage of HttpClient, not my own. Either way, it's not desirable.</p> <p><strong>UPDATE:</strong> Thanks for the attempts so far. I've tried everything suggested below but still no luck. I have a file commons-logging.properties in my src/test/resources folder with the following contents</p> <pre><code>org.apache.commons.logging.LogFactory=org.apache.commons.logging.impl.Log4jFactory log4j.configuration=log4j.properties </code></pre> <p>and a file log4j.properties in the same folder with the following contents</p> <pre><code>log4j.rootLogger=ERROR, stdout log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%5p [%c] %m%n #This is the line that should make httpclient shut up log4j.logger.org.apache.http=ERROR </code></pre> <p>However, when I run my tests I still get a bunch of output like this:</p> <pre><code>21:57:41.413 [main] DEBUG org.apache.http.wire - &lt;&lt; " [\r][\n]" 21:57:41.413 [main] DEBUG org.apache.http.wire - &lt;&lt; "[\r][\n]" 21:57:41.413 [main] DEBUG org.apache.http.wire - &lt;&lt; " [\r][\n]" 21:57:41.413 [main] DEBUG org.apache.http.wire - &lt;&lt; " &lt;/ul&gt;[\n]" 21:57:41.413 [main] DEBUG org.apache.http.wire - &lt;&lt; " [\n]" 21:57:41.424 [main] DEBUG org.apache.http.wire - &lt;&lt; "[\n]" 21:57:41.425 [main] DEBUG org.apache.http.wire - &lt;&lt; "[\r][\n]" 21:57:41.425 [main] DEBUG org.apache.http.wire - &lt;&lt; "[\r][\n]" 21:57:41.425 [main] DEBUG org.apache.http.wire - &lt;&lt; " &lt;/div&gt;[\r][\n]" 21:57:41.425 [main] DEBUG org.apache.http.wire - &lt;&lt; " &lt;/li&gt;[\r][\n]" 21:57:41.425 [main] DEBUG org.apache.http.wire - &lt;&lt; " [\r][\n]" 21:57:41.425 [main] DEBUG org.apache.http.wire - &lt;&lt; " [\r][\n]" 21:57:41.433 [main] DEBUG org.apache.http.wire - &lt;&lt; " &lt;/ul&gt;[\n]" 21:57:41.433 [main] DEBUG org.apache.http.wire - &lt;&lt; "&lt;/div&gt;[\n]" 21:57:41.433 [main] DEBUG org.apache.http.wire - &lt;&lt; "[\n]" 21:57:41.433 [main] DEBUG org.apache.http.wire - &lt;&lt; "&lt;/div&gt;[\n]" 21:57:41.433 [main] DEBUG org.apache.http.wire - &lt;&lt; "[\n]" 21:57:41.433 [main] DEBUG org.apache.http.wire - &lt;&lt; "[\n]" 21:57:41.433 [main] DEBUG org.apache.http.wire - &lt;&lt; "[\n]" 21:57:41.433 [main] DEBUG org.apache.http.wire - &lt;&lt; "[\n]" 21:57:41.433 [main] DEBUG org.apache.http.wire - &lt;&lt; "&lt;div class="details"&gt;[\n]" 21:57:41.442 [main] DEBUG org.apache.http.wire - &lt;&lt; "[\n]" 21:57:41.443 [main] DEBUG org.apache.http.wire - &lt;&lt; "[\n]" 21:57:41.443 [main] DEBUG org.apache.http.wire - &lt;&lt; "&lt;div class="details-body details-precis "&gt;[\n] " 21:57:41.443 [main] DEBUG org.apache.http.wire - &lt;&lt; "&lt;div class="details-state"&gt;[\n]" 21:57:41.443 [main] DEBUG org.apache.http.wire - &lt;&lt; "[\n]" 21:57:41.443 [main] DEBUG org.apache.http.wire - &lt;&lt; "&lt;/div&gt;[\n]" 21:57:41.443 [main] DEBUG org.apache.http.wire - &lt;&lt; "&lt;/div&gt;[\n]" 21:57:41.443 [main] DEBUG org.apache.http.wire - &lt;&lt; "[\n]" 21:57:41.455 [main] DEBUG org.apache.http.wire - &lt;&lt; "[\n]" 21:57:41.455 [main] DEBUG org.apache.http.wire - &lt;&lt; "&lt;/div&gt;[\n]" 21:57:41.455 [main] DEBUG org.apache.http.wire - &lt;&lt; "[\n]" 21:57:41.455 [main] DEBUG org.apache.http.wire - &lt;&lt; "&lt;/div&gt;[\n]" 21:57:41.455 [main] DEBUG org.apache.http.wire - &lt;&lt; "&lt;/div&gt;[\n]" 21:57:41.455 [main] DEBUG org.apache.http.wire - &lt;&lt; "[\n]" 21:57:41.455 [main] DEBUG org.apache.http.wire - &lt;&lt; "[\n]" 21:57:41.455 [main] DEBUG org.apache.http.wire - &lt;&lt; "[\n]" 21:57:41.455 [main] DEBUG org.apache.http.wire - &lt;&lt; "[\r][\n]" Destroying 1 processes21:57:41.465 [main] DEBUG org.apache.http.wire - &lt;&lt; "[\r][\n]" </code></pre> <p>This output for everything that comes across the wire is making this library unusable for me...that is until I can figure out how to turn it off. Is there anything special I need to do to get this log configuration read in?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload