[logback-user] Logback daily rollover and on every server startup

Gaurav Kumar gaurav419 at gmail.com
Tue Nov 6 22:20:52 CET 2012


With logback, is there a way to do daily Rollover AND also rollover on
every server restart?
I also wanted rollover based on Size, but I have seen an issue already
reported about this being a bug. If not, what is the best way to do this?

My setup:
For daily rollover I am using the following pattern:
* ....

where dateStr and timeStr are defined as:

*<timestamp key="dateStr" datePattern="yyyy-MM-dd"
<timestamp key="timeStr" datePattern="HHmmssSSS"

Also, I have the following triggering policy:*
*<timeBasedFileNamingAndTriggeringPolicy class="utils.


*LogbackLogTriggeringPolicy.java is:*
public class LogbackLogTriggeringPolicy<E> extends
DefaultTimeBasedFileNamingAndTriggeringPolicy<E> {
      public void start() {
          nextCheck = 0L;
*           isTriggeringEvent(null, null);
          try {
          } catch (RolloverFailure e) {
              //Do nothing

With the above *LogbackLogTriggeringPolicy I am able to achieve rollover on
server startup but daily rollover is not working. Any suggestions?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20121107/4b8cbb5f/attachment.html>

More information about the Logback-user mailing list