But I don't want to use commons-logging. I want to use log4j.

You are missing the point.  **You** want to use Log4j.  That's fine.  But HttpClient doesn't directly use Log4j.  It directly uses commons-logging, which is a Logger adapter that supports various logging implementations, one of which is Log4j.

If you want to use Log4j, then you ***have*** to use commons-logging.jar, and NOT commons-logging-api.jar, plus log4j.jar.  To avoid commons-logging (and some of the problems it can create), you can skip commons-logging.jar and use SLF4J [1]: jcl-over-slf4j.jar + slf4j-api.jar + slf4j-log4j12.jar + log4j.jar.  But either way, you can't avoid having the commons-logging packages/classes (which jcl-over-slf4j.jar mimics) in the classpath because HttpClient has a hard dependency on it.

In any case, that System.property stuff didn't help either.

Because it's commons-logging specific and totally irrelevant to Log4j.  Besides, you were setting Log4j packages as properties and that is totally meaningless.  For instance, you wrote...

  System.setProperty("log4j.logger.org.apache.http.client", "DEBUG");

But HttpClient's instructions say to do (again, read the instructions more closely)...      System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.http.wire", "DEBUG");

Part of the code simply gets..... ignored. Why?

Because you are not following instructions.


[1] http://slf4j.org/legacy.html#jcl-over-slf4j


Jake

On Tue, 10 Apr 2012 16:08:07 +0200
 tommmmmm <tommm...@gmail.com> wrote:
On 10 April 2012 15:34, Jacob Kjome <h...@visi.com> wrote:


That system property stuff only applies to commons-logging, not Log4j.
Look more closely at the instructions [1].

BTW, are you using commons-logging-api.jar?  If so, that's the problem.
You need commons-logging.jar.  See the commons-logging release notes [2].

[1] http://hc.apache.org/**httpcomponents-client-ga/**logging.html<http://hc.apache.org/httpcomponents-client-ga/logging.html> [2] http://commons.apache.org/**logging/RELEASE-NOTES.txt<http://commons.apache.org/logging/RELEASE-NOTES.txt>


Jake


But I don't want to use commons-logging. I want to use log4j. In any case,
that System.property stuff didn't help either.
Part of the code simply gets..... ignored. Why?


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org

Reply via email to