Tony,

In my case, the time based rolling is working, but the rolling stops all 
together when I add the size based triggering policy to the rolling appender.
I'm sure my understanding of the various classes is to blame, but I would 
expect to be able to create and set a simple SizeBasedTriggeringPolicy that 
would work
in parallel with the timeBasedRollingPolicy like in your example. I added the 
status listener as mentioned below and don't see any messages that correlate to 
the size trigger.
The messages that I do see about the time and file name pattern look correct.

Since yesterday I was able to get this working by using a SizeAndTimeBasedFNATP 
and setting it like 
rollingPolicy.setTimeBasedFileNamingAndTriggeringPolicy(stFNATP);
Is this the accepted approach to get simple roll-over each day with an 
additional max file size property?

On Dec 6, 2014, at 5:29 PM, Tony Trinh <[email protected]> wrote:

> Chris,
> 
> To help troubleshoot rollover issues, you can enable logback debug statements 
> with:
> 
>            LoggerContext context = (LoggerContext) 
> LoggerFactory.getILoggerFactory();
> 
>         // Enable debugging to show rollover status
>         OnConsoleStatusListener.addNewInstanceToContext(context);
> 
> This will print any status messages when logback attempts to rollover the 
> file.
> 
> See the working example that demonstrates the RollingFileAppender:
> https://github.com/tony19/logback-examples/blob/master/logback-android/rolling-file-appender/app/src/main/java/com/github/tony19/rollingfileappender/MainActivity.java#L93
> 
> Tony
> 
> 
> On Tue, Dec 2, 2014 at 5:48 PM, Chris Kelly <[email protected]> wrote:
> I've gone through a bit of trial and error, and have not been able to get 
> logs to roll over, no matter how aggressively I set up triggering and rolling 
> policies.
> My intent is to have daily logs with a max size all configured in code, thus 
> no assets/logback.xml.
> 
> I've enabled debugging and the only status message is (which I would expect):
>         I/System.outīš• 17:37:13,194 |-INFO in 
> ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource 
> [assets/logback.xml]
> 
> In a nutshell I have the TimeBasedRollingPolicy set up to use a file as
>         rollingPolicy.setFileNamePattern(ctx.getCacheDir().getAbsolutePath() 
> + File.separator + "logs" + File.separator + name +".%d{yyyy-MM-dd_HH}.log"); 
> // exprimenting with hourly
> and the size based triggering at 25k like
>         sizeTriggerPolicy.setMaxFileSize("25KB");
> 
> I then set these to the rollingFileAppender, set up a pattern encoder and add 
> it, then start the appender.
> I can see the messages in my log file as expected, but it continues to grow 
> well past the max size and past any time based trigger (even while log events 
> continue).
> 
> Any suggestions?
> 
> Thanks,
> Chris
> 
> 
> _______________________________________________
> Logback-user mailing list
> [email protected]
> http://mailman.qos.ch/mailman/listinfo/logback-user
> 
> _______________________________________________
> Logback-user mailing list
> [email protected]
> http://mailman.qos.ch/mailman/listinfo/logback-user

_______________________________________________
Logback-user mailing list
[email protected]
http://mailman.qos.ch/mailman/listinfo/logback-user

Reply via email to