Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><em>Note: Some of this answer might repeat things you already know (or think you know), but there is a bit of mis-information floating around on this question, so I'm going to start at the beginning and spell it all out</em></p> <ul> <li>Commons HttpClient uses Commons-Logging for all its logging needs.</li> <li>Commons-Logging is not a full logging framework, but rather, is a wrapper around several existing logging frameworks</li> <li>That means that when you want to control the logging output, you (mostly) end up configuring a library other than Commons-Logging, <em>but</em> because Commons-Logging wraps around several other libraries, it's hard for us to guess which one to configure without knowing your exactly setup.</li> <li>Commons-Logging can log to log4j, but it can also log to <code>java.util.logging</code> (JDK1.4 logging)</li> <li>Commons-Logging tries to be smart and guess which logging framework you are already using, and send its logs to that.</li> <li>If you don't already have a logging framework, and are running on a JRE that's 1.4 or above (which you really should be) then it will probably be sending its log messages to the JDK logging (<code>java.util.logging</code>)</li> <li>Relying on Commons-Logging's autodiscovery mechanism is prone to error. Simply adding <code>log4j.jar</code> onto the classpath would cause it to switch which logging mechanism it uses, which probably isn't what you want</li> <li><strong>It is preferable for you to explicitly tell Commons-Logging which logging library to use</strong></li> <li>You can do this by creating a <code>commons-logging.properties</code> file as per <a href="http://commons.apache.org/logging/guide.html#Configuration" rel="noreferrer">these instructions</a></li> <li>The steps you want to follow to configure the commons-httpclient logging are <ol> <li>Decide which underlying logging framework you want to use. There are a number of choices, but probably <code>log4j</code> or <code>java.util.logging</code> are the best options for you.</li> <li>Set-up the commons-logging properties file to point to the correct <code>Log</code> implementation. e.g. to use log4j, put this into the properties file: <code>org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger</code>, or to use JDK logging set <code>org.apache.commons.logging.Log=org.apache.commons.logging.impl.Jdk14Logger</code>. These can also be set as system properties (e.g. using <code>-D</code> on the command line).</li> <li>Configure the underlying logging implementation (e.g. log4j) to ignore the messages you don't want, and output the messages you do want.</li> </ol></li> </ul> <p>That's a lot of steps, but that's what it takes. The developers at Apache-commons tend to assume you'll already have a logging framework configured, and they can work out which one it is by auto-discovery.<br> If that's not true for you, then it tends to be a bit more work to get things running.</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