title: Log4j, disable appenders dependent on environment
body: <p>I would like to have one log4j.xml config and be able to log to console while developing my application. Once deployed to an environment I want to only log to a file appender and not the console. How can I achieve this?</p>
  
  <p>This is my current config:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
  &lt;!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"&gt;
  
  &lt;log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"&gt;
  
      &lt;appender name="ConsoleAppender" class="org.apache.log4j.ConsoleAppender"&gt;
          &lt;param name="Threshold" value="DEBUG" /&gt;
          &lt;param name="Target" value="System.out" /&gt;
          &lt;layout class="org.apache.log4j.PatternLayout"&gt;
              &lt;param name="ConversionPattern" value="%d{dd-MM-yyyy HH:mm:ss} %-5p%c{1} - %m%n" /&gt;
          &lt;/layout&gt;
      &lt;/appender&gt;
  
      &lt;appender name="LogFileAppender" class="org.apache.log4j.RollingFileAppender"&gt;
          &lt;param name="File" value="${log-base-dir}/${adapter-name}.log" /&gt;
          &lt;param name="MaxFileSize" value="5000KB" /&gt;
          &lt;param name="MaxBackupIndex" value="99" /&gt;
          &lt;param name="append" value="true" /&gt;        
          &lt;layout class="org.apache.log4j.PatternLayout"&gt;
              &lt;param name="ConversionPattern" value="%d{dd-MM-yyyy HH:mm:ss} %-5p%c{1} - %m%n" /&gt;
          &lt;/layout&gt;
      &lt;/appender&gt;
  
      &lt;root&gt;
          &lt;level value="info" /&gt;
          &lt;appender-ref ref="ConsoleAppender" /&gt;
          &lt;appender-ref ref="LogFileAppender" /&gt;
      &lt;/root&gt;
  
  &lt;/log4j:configuration&gt;
  </code></pre>