<div dir="ltr"><p style="margin:0px 0px 1.1em;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:inherit;font-size:15px;vertical-align:baseline;box-sizing:inherit;clear:both">I have a basic spring boot application with the logback.xml below</p><pre style="white-space:pre-wrap;margin-top:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;vertical-align:baseline;box-sizing:inherit;width:auto;max-height:600px;overflow:auto"><code style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline;box-sizing:inherit;background-color:transparent;white-space:inherit;border-radius:0px"><configuration>
<appender name="ROLLING" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>mylog.txt</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>mylog-%d{yyyy-MM-dd}.%i.txt</fileNamePattern>
<maxFileSize>1MB</maxFileSize>
<maxHistory>60</maxHistory>
<totalSizeCap>1GB</totalSizeCap>
</rollingPolicy>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %-4relative [%thread] %-5level %logger{35} - %msg%n</pattern>
</encoder>
</appender>
<root level="DEBUG">
<appender-ref ref="ROLLING"/>
</root>
</configuration></code></pre><pre style="white-space:pre-wrap;margin-top:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;vertical-align:baseline;box-sizing:inherit;width:auto;max-height:600px;overflow:auto"><code style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline;box-sizing:inherit;background-color:transparent;white-space:inherit;border-radius:0px"><br></code></pre><pre style="white-space:pre-wrap;margin-top:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;vertical-align:baseline;box-sizing:inherit;width:auto;max-height:600px;overflow:auto"><code style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline;box-sizing:inherit;background-color:transparent;white-space:inherit;border-radius:0px"><div style="margin:0px;padding:0px;border:0px;font-variant-numeric:inherit;font-variant-east-asian:inherit;font-stretch:inherit;font-family:-apple-system,"system-ui","Segoe UI Adjusted","Segoe UI","Liberation Sans",sans-serif;vertical-align:baseline;box-sizing:inherit;width:654.203px;white-space:normal"><p style="margin:0px 0px 1.1em;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:inherit;font-size:15px;vertical-align:baseline;box-sizing:inherit;clear:both">I created logs with the following code to test the rolling.</p><pre style="white-space:pre-wrap;margin-top:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;vertical-align:baseline;box-sizing:inherit;width:auto;max-height:600px;overflow:auto"><code style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline;box-sizing:inherit;background-color:transparent;white-space:inherit;border-radius:0px">@Slf4j
@SpringBootApplication
public class LogbackApplication implements CommandLineRunner {
public static void main(String[] args) {
SpringApplication.run(LogbackApplication.class, args);
}
@Override
public void run(String... args) throws Exception {
for (int i = 0; i < 100000; i++) {
log.debug("This is DEBUG");
<a href="http://log.info/" target="_blank">log.info</a>("This is INFO");
log.warn("This is WARN");
}
}
}
</code></pre><p style="margin:0px 0px 1.1em;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:inherit;font-size:15px;vertical-align:baseline;box-sizing:inherit;clear:both">I observed a log file of more than 25 MB. It is not rolling. If I put some sleep statements inside logging, it rolls.</p><p style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:inherit;font-size:15px;vertical-align:baseline;box-sizing:inherit;clear:both">Is it a bug? or am I misconfiguring it? or expected behavior because of performance reasons?</p></div><div style="margin-right:0px;margin-left:0px;padding:0px;border:0px;font-variant-numeric:inherit;font-variant-east-asian:inherit;font-stretch:inherit;line-height:inherit;font-family:-apple-system,"system-ui","Segoe UI Adjusted","Segoe UI","Liberation Sans",sans-serif;vertical-align:baseline;box-sizing:inherit;white-space:normal"><div style="margin-right:0px;margin-bottom:10px;margin-left:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:inherit;vertical-align:baseline;box-sizing:inherit;clear:both;display:flex"><div style="margin-right:0px;margin-left:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:inherit;vertical-align:baseline;box-sizing:inherit;display:flex"><br style="color:rgb(35,38,41);font-size:13px"></div></div></div></code></pre></div>