title: Log4j2 Naming custom file name with date & time for Rollover file
body: <p>I have recently upgraded to log4j1.x to log4j2.x and presently working with library 2.12.4 as application running with Java 7</p>
  <p>I want to configure rollover file policy (time based) along with adequate rolled over fill name
  I found issues with log4j2 configuration that rollover file name and time frequency both together in one syntax as below</p>
  <p>filePattern=&quot;/opt/app/appUAT/uat/app-UAT-UAT/logs/appNameServerUAT-SIT2_%d{yyyyMMdd}.log&quot;&gt;</p>
  <p>Here I couldn’t mention rolled over file name more with time stamp value as this would disturb rollover frequency.
  For now I am only targeting rollover daily once in a day but going forward I wish to have intraday rollover as well.</p>
  <p>I want to achieve following</p>
  <p>   Give initial file name along with date &amp; time value but this will cause logical incorrect once rollover done</p>
  <p>   I want to give rollover file name along with date &amp; time value but this I don’t want to disturb with planned rollover frequency. Expected rollover frequency would be once every new day as new logging file</p>
  <p>   I want to rollover policy be like to gz only 7 days old logs where as normal daily rollover must continue for every new day – i.e. new log file for every new day</p>
  <p>Applied configuration snippet as below</p>
  <pre><code>&lt;Appenders&gt;
      &lt;Console name=&quot;LogToConsole&quot; target=&quot;SYSTEM_OUT&quot;&gt;
          &lt;PatternLayout pattern=&quot;%d{yyyyMMdd HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n&quot;/&gt;
      &lt;/Console&gt;
      &lt;RollingFile name=&quot;LogToRollingFile&quot; fileName=&quot;/opt/app/AppUAT/uat/App-UAT-UAT/logs/AppServerUAT-SIT2_${date:yyyyMMdd}_${date:HHmmss}.log&quot;
                  filePattern=&quot;/opt/app/AppUAT/uat/App-UAT-UAT/logs/AppServerUAT-SIT2_%d{yyyyMMdd}.log&quot;&gt;
      &lt;PatternLayout&gt;
          &lt;Pattern&gt;%d{yyyyMMdd HH:mm:ss.SSS} [%t] %-5level [%C][%M] - %m%n&lt;/Pattern&gt;
      &lt;/PatternLayout&gt;
      &lt;Policies&gt;
          &lt;TimeBasedTriggeringPolicy interval=&quot;1&quot; modulate=&quot;true&quot;/&gt;
      &lt;/Policies&gt;
  &lt;/RollingFile&gt;
  &lt;/Appenders&gt;
  </code></pre>