[logback-user] Possible issue with time based rolling policy when using format %d{yyyy-MM-dd-a}

Christopher.White at bbh.com Christopher.White at bbh.com
Thu Mar 24 14:00:23 CET 2011

Hi all,

My goal is to have my log file roll over twice a day (one to hold all AM 
logs, and one to hold all PM logs). Here is my configuration in 

    <appender name="FILE" class="
        <rollingPolicy class="
            <pattern>[%date] [%thread] [%level] [%mdc] 
[%logger:%method:%line]: %msg%n</pattern>

This configuration does result in the correct naming of archived log files 
(e.g. TransactionReporting.2011-03-22-AM.gz). However, the contents of the 
archived log files do not just contain half of the day's log entries.

Whether the archived log file name ends in "...AM.gz" or "...PM.gz" these 
log files can contain log entries for both the morning and the evening.

And, the same goes for the active log file (TransactionReporting.log). 
This active log file does not get archived when the time changes from AM 
to PM...so the log file contains log entries for both the morning and the 

It seems as if the log file is rolling over only once a day, but I don't 
believe that it rolls over at the same time every day. Based on the 
modified date value on the archived files, it seems completely random as 
to when the file is actually rolled over.

Any help or advice would be greatly appreciated.


Christopher White
Sr. Programmer
Christopher.White at bbh.com

*************************** IMPORTANT
NOTE*****************************-- The opinions expressed in this
message and/or any attachments are those of the author and not
necessarily those of Brown Brothers Harriman & Co., its
subsidiaries and affiliates ("BBH"). There is no guarantee that
this message is either private or confidential, and it may have
been altered by unauthorized sources without your or our knowledge.
Nothing in the message is capable or intended to create any legally
binding obligations on either party and it is not intended to
provide legal advice. BBH accepts no responsibility for loss or
damage from its use, including damage from virus.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://qos.ch/pipermail/logback-user/attachments/20110324/77738e76/attachment.html>

More information about the Logback-user mailing list