
any suggestions? On Wed, Nov 7, 2012 at 2:50 AM, Gaurav Kumar <gaurav419@gmail.com> wrote:
Hi,
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: * .... <file>${jetty.home}/logs/testapp.${dateStr}.log</file> .... ** <fileNamePattern>${jetty.home}/logs/testapp.%d{yyyy-MM-dd}.log.${timeStr}</fileNamePattern>
where dateStr and timeStr are defined as: *
*<timestamp key="dateStr" datePattern="yyyy-MM-dd" timeReference="contextBirth"/> <timestamp key="timeStr" datePattern="HHmmssSSS" timeReference="contextBirth"/>
Also, I have the following triggering policy:* *<timeBasedFileNamingAndTriggeringPolicy class="utils. LogbackLogTriggeringPolicy"/>
*
*LogbackLogTriggeringPolicy.java is:* *@NoAutoStart public class LogbackLogTriggeringPolicy<E> extends DefaultTimeBasedFileNamingAndTriggeringPolicy<E> { @Override public void start() { super.start(); nextCheck = 0L; * * isTriggeringEvent(null, null); try { tbrp.rollover(); } 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?
Thanks!