title: Set apache HttpClient log level explicitly
body: <p>I am developing a web application which among the other uses the apache HttpClient to make some httpRequest.<br>
  For logging I am using slf4j with the slf4j-log4j12 'plug in'</p>
  
  <p>What I want is to have DEBUG log level for my application but WARN level for the HttpClient. I am seeting the logging properties in <code>log4j.properties</code>.</p>
  
  <pre><code>log4j.rootLogger=DEBUG,console,file
  
  log4j.appender.console=org.apache.log4j.ConsoleAppender
  log4j.appender.console.layout=org.apache.log4j.PatternLayout   
  log4j.appender.console.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
  
  log4j.appender.file=org.apache.log4j.RollingFileAppender   
  log4j.appender.file.File=log.log   
  log4j.appender.file.threshold=DEBUG
  </code></pre>
  
  <p>The initialization and logging is like that   </p>
  
  <pre><code>import org.slf4j.LoggerFactory;
  private static final org.slf4j.Logger LOG = LoggerFactory.getLogger(&lt;MY_CLASS&gt;.class.getName());
  
  LOG.debug("This is debug info");
  LOG.warn("This is warn info");
  </code></pre>
  
  <p>Until now I am setting the following to the class that uses HttpClient</p>
  
  <pre><code>System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.NoOpLog");
  </code></pre>
  
  <p>In order to 'deactivate' logging, but this stops the logging completely and does not set the level to WARN as I want.</p>
  
  <p>Until now I have tried what is proposed on the following SO questions but with no luck. I have also seen many other which suggest pretty much the same.</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/4915414/disable-httpclient-logging">Disable HttpClient logging</a></li>
  <li><a href="https://stackoverflow.com/questions/2770382/logs-are-filling-up-with-httpclient-wire-content-dumps-how-can-i-turn-it-off">Logs are filling up with httpclient.wire.content dumps. How can I turn it off?</a></li>
  </ul>
  
  <p>Passing parameters on execution such as <code>java -Dlog4j</code> is not a solution for me.</p>
  
  <p>As a sidenote my project has two modules,</p>
  
  <ul>
  <li>The 'parent module' defines the logging properties and has the slf4j (1.7.5) and slf4j-log4j12 dependencies</li>
  <li>The child module is where I am using the HttpClient (4.3.4), it has only the<br>
  slf4j (1.7.5) dependency</li>
  </ul>