[logback-user] daily rollover w/ timezone problem

Paul ppage4 at yahoo.com
Tue Feb 21 22:32:34 CET 2012


If I setup a daily rollover with EST timezone I see the following in the log for yesterday:

-----
<stuff deleted>
2012-02-20 18:58:51 INFO [main] logBackMain [logBackMain.java:19] step 1366
2012-02-20 18:59:01 INFO [main] logBackMain [logBackMain.java:19] step 1367
2012-02-20 18:59:11 INFO [main] logBackMain [logBackMain.java:19] step 1368
2012-02-20 18:59:21 INFO [main] logBackMain [logBackMain.java:19] step 1369
2012-02-20 18:59:31 INFO [main] logBackMain [logBackMain.java:19] step 1370
2012-02-20 18:59:41 INFO [main] logBackMain [logBackMain.java:19] step 1371
2012-02-20 18:59:51 INFO [main] logBackMain [logBackMain.java:19] step 1372
-----

The last logged message is close to 7pm EST or midnight GMT. With this setup a single day now shows up across 2 log files which makes trouleshooting application errors more difficult. Is there a way to have both EST time output and rollover happening relative to EST? Maybe there is a way to subtract an offset to the time of 5hrs?

Here is my test appender:

<appender name="DAILY" class="ch.qos.logback.core.rolling.RollingFileAppender"> 
    <file>daily.log</file> 
    <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> 
       
      <fileNamePattern>daily.%d{yyyy-MM-dd}.log</fileNamePattern> 
 
      <!-- keep 30 days' worth of history --> 
      <maxHistory>30</maxHistory> 
    </rollingPolicy> 
    
    <encoder> 
      <pattern>%date{yyyy-MM-dd HH:mm:ss,EST} %level [%thread] %logger{10} [%file:%line] %msg%n</pattern> 
    </encoder> 
  </appender> 



thanks,
Paul.





More information about the Logback-user mailing list