0

Can someone please help on how to configure log4j2 with RollingFile appender which generates two log files per day (AM/PM)?

Tried this, but it doesn't work

<RollingFile name="fileAppender" fileName="${logName}"
                 append="true" filePattern="${logName}.%d{yyyy-MM-dd-a}">
                 <PatternLayout
                       pattern="[%d{DEFAULT}]:[%-5p]:[%15c{1}]:[%15t] - %m%n" />
                 <Policies>
                       <TimeBasedTriggeringPolicy interval="1"
                              modulate="true" />
                 </Policies>
          </RollingFile>
rivaham
  • 25
  • 4

1 Answers1

0

Can you try using the CronTriggeringPolicy?

rgoers
  • 8,696
  • 1
  • 22
  • 24
  • Thanks rgoers. Not able to find any example, do you have one? – rivaham Mar 17 '16 at 19:40
  • The cron triggering policy is documented at http://stackoverflow.com/posts/comments/59786515?noredirect=1. You can find a description of the cron pattern at http://www.quartz-scheduler.org/documentation/quartz-1.x/tutorials/crontrigger. – rgoers Mar 19 '16 at 12:00