title: How to give dynamic file name in the appender in log4j.xml
body: <p>I am using log4j to log information. I have used a <code>log4j.xml</code> file for creating log files. I have given the absolute path for each log file as a <code>param</code> tag value.</p>
  
  <p>E.g.:</p>
  
  <pre><code>&lt;appender name="FA" class="org.apache.log4j.DailyRollingFileAppender"&gt;
    &lt;param name="DatePattern" value="'_'yyyyMMdd"/&gt;
    &lt;param name="File" value="D:/logFiles/GPreprocessor.log"/&gt;
    &lt;layout class="com.dnb.genericpreprocessor.common.log.AppXMLLayout"/&gt;
  &lt;/appender&gt;
  </code></pre>
  
  <p>I do not want to write "GPreprocessor.log" directly. Actually, that file name is dynamic, based on my project's name. For example, if I run the program ABC.java, logging should go to <code>D:/logFiles/ABC.log</code>, but if I run XYZ.java, logging should go to <code>D:/logFiles/XYZ.log</code>. The file's location will always remain the same: <code>D:/logFiles/</code>. How can I change the log file's name dynamically?</p>