2 years ago

#42988

test-img

codeitforfuture

RuntimeException in Action for tag [rollingPolicy] java.lang.IllegalStateException: FileNamePattern [] does not contain a valid DateToken

I used SLF4J for logging in a java application, not spring application, but i get this error and i dont know how to deal with it :

17:26:01,117 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@16:25 - RuntimeException in Action for tag [rollingPolicy] java.lang.IllegalStateException: FileNamePattern [C:/Users/ema/logs/slk4j.%i.log] does not contain a valid DateToken

This is the logback.xml file :

<configuration>


    <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${user.home}/logs/slk4j.log</file>
        <append>false</append>

        <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
            <fileNamePattern>${user.home}/logs/slk4j.%i.log</fileNamePattern>
            <!-- each archived file, size max 10MB -->
            <maxFileSize>10MB</maxFileSize>
            <!-- total size of all archive files, if total size > 20GB, it will delete old archived file -->
            <totalSizeCap>20GB</totalSizeCap>
            <!-- 60 days to keep -->
            <maxHistory>60</maxHistory>
        </rollingPolicy>

        <encoder>
            <pattern>%d %p %c{1.} [%t] %m%n</pattern>
        </encoder>
    </appender>


    <root level="DEBUG">
        <appender-ref ref="FILE"/>
    </root>

</configuration>

java

logback

0 Answers

Your Answer

Accepted video resources