title: How to set log level in log4j from properties file in runtime
body: <p>How do I set log level in <code>log4j.xml</code> using properties file in <code>runtime time</code>?</p>
  
  <pre><code>&lt;appender name="ConsoleAppender" class="org.apache.log4j.ConsoleAppender"&gt;
      &lt;layout class="org.apache.log4j.PatternLayout"&gt;
          &lt;param name="ConversionPattern"
                 value="%d{ABSOLUTE} %-5p [%c{1}] [%t]: %m%n" /&gt;
      &lt;/layout&gt;
  &lt;/appender&gt;
  
  &lt;logger name="com.mypackage" additivity="false"&gt;
      &lt;level value="${level}" /&gt;
      &lt;appender-ref ref="ConsoleAppender" /&gt;
  &lt;/logger&gt;
  </code></pre>
  
  <p>I set the value of <code>$level</code> from my <code>vm arguments</code> by passing the value as <code>-Dlevel="warn"</code> so that all messages with level warn and above got logged.</p>
  
  <p>Now my problem is I have to set the value of log level from a <code>properties</code> file instead of <code>vm arguments</code> ? How can I do this?</p>
  
  <p>P.S : I am using common.logging in the java code with log4j as a configuration mechanism.</p>