[logback-dev] [JIRA] (LOGBACK-1348) SizeAndTimeBasedRollingPolicy on Windows sometimes exceeds maxFileSize and file counter explodes
QOS.CH (JIRA)
noreply-jira at qos.ch
Fri Oct 20 14:11:00 CEST 2017
Martin Wegner created LOGBACK-1348:
--------------------------------------
Summary: SizeAndTimeBasedRollingPolicy on Windows sometimes exceeds maxFileSize and file counter explodes
Key: LOGBACK-1348
URL: https://jira.qos.ch/browse/LOGBACK-1348
Project: logback
Issue Type: Bug
Components: logback-core
Affects Versions: 1.2.3
Environment: Windows Server 2012 R2
Reporter: Martin Wegner
Assignee: Logback dev list
I have at least two cases where the maxFileSize (5MB) was exceeded and the file counter exploded.
xxx.2017-10-11.5.json with 5MB
{color:red}xxx.2017-10-11.12186.json 32.4MB{color}
xxx.2017-10-11.12187.json 1.33MB
xxx.2017-10-19.8.json with 5MB
{color:red}xxx.2017-10-19.1626.json with 8.98MB{color}
xxx.2017-10-19.1627.json with 2.82MB
My guess is, that the log file had a size of 4.99MB and then several threads simultaneously wrote into the same log file and therefore parallel rollovers occurred?
{code:xml}
<appender name="JSON_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${fileNamePrefix}.json</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!-- daily rollover -->
<fileNamePattern>${fileNamePrefix}.%d{yyyy-MM-dd}.%i.json</fileNamePattern>
<!-- keep 30 days' worth of history -->
<maxHistory>30</maxHistory>
<!-- each file should be at most 5MB -->
<maxFileSize>5MB</maxFileSize>
</rollingPolicy>
<!-- encoders are assigned the type
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
<encoder class="net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder">
<providers>
<timestamp>
<fieldName>timestamp</fieldName>
</timestamp>
<logLevel>
<fieldName>logLevel</fieldName>
</logLevel>
<threadName>
<fieldName>threadName</fieldName>
</threadName>
<loggerName>
<fieldName>loggerName</fieldName>
</loggerName>
<callerData>
<classFieldName>className</classFieldName>
<methodFieldName >methodName</methodFieldName>
<fileFieldName>[ignore]</fileFieldName>
<lineFieldName>lineNumber</lineFieldName>
</callerData>
<message />
<stackTrace>
<fieldName>stackTrace</fieldName>
<throwableConverter class="net.logstash.logback.stacktrace.ShortenedThrowableConverter">
<maxDepthPerThrowable>30</maxDepthPerThrowable>
<rootCauseFirst>true</rootCauseFirst>
</throwableConverter>
</stackTrace>
</providers>
</encoder>
</appender>
{code}
--
This message was sent by Atlassian JIRA
(v7.3.1#73012)
More information about the logback-dev
mailing list