tommmmmm | 10 Apr 12:23 2012
Picon

Log4J doesn't work at all

From: http://hc.apache.org/httpcomponents-client-ga/logging.html
I copy pasted

log4j.rootLogger=INFO, 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

log4j.logger.org.apache.http=DEBUG
log4j.logger.org.apache.http.wire=ERROR

Into a file I named log4j.properties that I put into src folder a'ka
<default package>

Didn't work at all.

Then I put this in my class:

System.setProperty("log4j.rootLogger", "INFO, stdout");

System.setProperty("log4j.appender.stdout",
"org.apache.log4j.ConsoleAppender");

System.setProperty("log4j.appender.stdout.layout",
"org.apache.log4j.PatternLayout");

System.setProperty("log4j.appender.stdout.layout.ConversionPattern",
"%5p [%c] %m%n");

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

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

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

Yet it didn't work at all either. No additional output was produced.

How do you make it work?

ps: at: http://logging.apache.org/log4j/1.2/manual.html

It's not written how to do it (empty paragraph "Example
Configurations" and non empty yet ultimately useless Tomcat
paragraph).

Gmane