History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: LBCORE-138
Type: Improvement Improvement
Status: Open Open
Priority: Minor Minor
Assignee: Logback dev list
Reporter: Andreas Dejung
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
logback-core

Enable using a subclass of RollingCalendar

Created: 04/Mar/10 12:06 AM   Updated: 04/Mar/10 12:08 AM
Component/s: Appender
Affects Version/s: 0.9.18
Fix Version/s: None

File Attachments: 1. Java Source File SpecificTimeRollingCalendar.java (1 kb)

Environment: N/A


 Description  « Hide
Hi all

What I can see there is no way to roll the file on a specific time. E.g. every day at 17:00

As we require this I had a closer look on how logback decides to roll. I found the ch.qos.logback.core.rolling.helper.RollingCalendar is responsible to define when the next roll should happen. I extended it so that one can define the time rather then 0:00 if you roll daily.

Now my problem is that there is no way to set my extended RollingCalander on the TimeBasedFileNameAndTriggeringPolicyBase as it is created inside the start method. Overriding the start of TimeBasedFileNameAndTriggeringPolicyBase and do the same without calling the super method works only if me override is in the same package which is not a nice thing. The problem would be easy solved if you would add a setter for the RollingCalander to the TimeBasedFileNameAndTriggeringPolicyBase and then change the line

rc = new RollingCalendar();

to
if(rc==null){
            rc = new RollingCalendar();
      }

Clearly I could just go ahead and change that by myself but I thought maybe someone else want's this as well and it would be nice not to keep a separate code base.

Cheers Andy


 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Andreas Dejung - 04/Mar/10 12:08 AM
Here the example of the RollingCalendar extension