<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <!-- <cleanHistoryOnStart>true</cleanHistoryOnStart> -->
    <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>./logs/log.txt</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
            <!-- daily rollover -->
            <fileNamePattern>./logs/log.%d{yyyy-MM-dd}.%i.txt.zip</fileNamePattern>

            <!-- Each file should be at most 5MB -->
            <maxFileSize>5MB</maxFileSize>

            <!-- keep 15 days' worth of history -->
            <maxHistory>15</maxHistory>

            <!-- Optional: Total size cap to prevent disk from filling up -->
            <totalSizeCap>500MB</totalSizeCap>
        </rollingPolicy>

        <encoder>
            <pattern>%d{HH:mm:ss.SSS} %-5level %thread | %msg%n</pattern>
        </encoder>
    </appender>

    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
            <pattern>%d{HH:mm:ss.SSS} %-5level %thread | %msg%n</pattern>
        </encoder>
    </appender>

    <root level="INFO">
        <appender-ref ref="FILE" />
        <appender-ref ref="STDOUT" />
    </root>
</configuration>