I have a basic spring boot application with the logback.xml below <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> I created logs with the following code to test the rolling. @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"); log.info("This is INFO"); log.warn("This is WARN"); } } } I observed a log file of more than 25 MB. It is not rolling. If I put some sleep statements inside logging, it rolls. Is it a bug? or am I misconfiguring it? or expected behavior because of performance reasons?
_______________________________________________ logback-user mailing list logback-user@qos.ch https://mailman.qos.ch/cgi-bin/mailman/listinfo/logback-user