[logback-user] Question about SizeAndTimeBasedRollingPolicy
Simon.Erhardt at befine-solutions.com
Simon.Erhardt at befine-solutions.com
Fri Apr 8 15:03:47 UTC 2016
Hello all,
I've got a question about the SizeAndTimeBasedRollingPolicy. What I would
like to achieve is a guaranteed upper boundary for the disk space used by
log files and archives. I was happy to find the related option
"totalSizeCap" for SizeAndTimeBasedRollingPolicy which seemed to help, but
it turns out that this cap is applied only to files older than the
time-based rollover trigger (in my case, a new day). The same seems to be
the case for "maxHistory", it doesn't constrain the count of files created
on the current day. So it is possible that, in worst case, a lot of files
are created and flush disk space.
Are there any ideas how to solve that? I read about
FixedWindowRollingPolicy, but I need day based rollover. Here's my
non-working approach so far:
<appender name="FILE_DEFAULT"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>events.log</file>
<encoder><Pattern>${defaultPattern}</Pattern></encoder>
<rollingPolicy
class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>events_%d{yyyy-MM-dd}_%i.zip</fileNamePattern>
<maxFileSize>1MB</maxFileSize>
<maxHistory>5</maxHistory>
<totalSizeCap>10MB</totalSizeCap>
</rollingPolicy>
</appender>
I'm looking forward to any responses. Have a nice weekend!
Simon Erhardt
Senior Software Architect
Befine Solutions AG - The Cryptshare company
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20160408/22645be2/attachment.html>
More information about the logback-user
mailing list