title: Disable log4j output during unit-tests
body: <p>It's common practice to obtain loggers via static-factory (though it totally brokes DI principle). And actually it's fine, unless you would like to get rid of logging totally, e.g. while running unit-tests.</p>
  
  <p>I was able to switch off <em>log4j</em> logging, by using following spell:</p>
  
  <pre><code> List&lt;Logger&gt; loggers = Collections.&lt;Logger&gt;list(LogManager.getCurrentLoggers());
   loggers.add(LogManager.getRootLogger());
   for (Logger logger : loggers) {
       logger.setLevel(Level.OFF);
   }
  </code></pre>
  
  <p>Still it prints some setup info to the console in the very beginning:</p>
  
  <pre><code>log4j: reset attribute= "false".
  log4j: Threshold ="null".
  log4j: Retreiving an instance of org.apache.log4j.Logger.
  log4j: Setting [test] additivity to [false].
  log4j: Level value for test is  [DEBUG].
  ...
  </code></pre>
  
  <p>How do I disable it as well, <strong>programmatically</strong>, while running unit-test suite? </p>