[logback-user] Rolling files on Android
Chris Kelly
chris at thursby.com
Wed Dec 3 00:48:12 CET 2014
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
More information about the Logback-user
mailing list