|
||||||||
This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira |
_______________________________________________ logback-dev mailing list logback-dev@qos.ch http://mailman.qos.ch/mailman/listinfo/logback-dev
I have a decent solution, testing it now. Only had to touch 3 java files, and changes are pretty small.
Here is what I did. First, I added to TimeBasedFileNamingAndTriggeringPolicy.java a setTimeZone(TimeZone timeZone) method, and implemented it in TimeBasedFileNamingAndTriggeringPolicyBase.java, where I used it to instantiate RollingCalendar object.
In TimeBasedRollingPolicy I added two optional parameters: timeZone and rollTime (expected format hh:mm:ss), I create a custom time zone using this information and pass it to timeBasedFileNamingAndTriggeringPolicy.
This way I can specify the time of the day when rollover happens, with seconds precision.
Here is how it look in configuration:
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
{LOG_FILE_BASE}<file>$
.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<timeZone>America/New_York</timeZone>
<rollTime>14:50:00</rollTime>
.............................
Obviously this feature is helpful mostly for daily rollover, but can be used for hourly and smaller.
To make it useful for the weekly and monthly, I just need to add one more parameter: number of days to shift. This is easy, but I am not sure if anybody would need it.
After I am done with my testing, I would be happy to share it, I just need to learn how to do the pull request.