wrong date with policy SizeAndTimeBasedRollingPolicy after creation of file by size and date change

18 Views Asked by At

I have found a new bug provoked by my new logback configuration and I do not know why.

Yesterday, I had the file test_2024_01_23.0.log which was created and normally I should have test_2024_01_24.log today, but I got test_2024_01_22.log

    <timestamp key="timestamp" datePattern="yyyy_MM_dd"/>
    <property name="HOME_LOG_METIER" value="/logs/test_metier_${timestamp}.log"/>

  <appender name="FILE_METIER" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${HOME_LOG_METIER}</file>
        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
            <pattern>%d %p %c{0} [%t] %m%n</pattern>
        </encoder>
        <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
            <fileNamePattern>/logs/test_metier_%d{yyyy_MM_dd}.%i.log</fileNamePattern>
            <MaxFileSize>10MB</MaxFileSize>>
        </rollingPolicy>
    </appender>

Do you have any ideas about that?

regards, Mat

0

There are 0 best solutions below