I have configured my logback.xml as bellow but I am getting error at run time please any one help me to figure out.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<property name="LOG_DIR" value="D:\\FlightReserVAtionProject\\LOG">
<appender name="FILE"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_DIR}\\${FILE_PREFIX}.log</file>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>$%d{yyyy-MM-dd HH:mm:ss} - %msg%n</pattern>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${LOG_DIR}\\archived\\${FILE_PREFIX}.$%d{yyyy-MM-dd
HH:mm:ss}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy
class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"></timeBasedFileNamingAndTriggeringPolicy>
<maxFileSize>2MB</maxFileSize>
</rollingPolicy>
</appender>
</configuration>
The error is
java.lang.IllegalStateException: Logback configuration error detected: ERROR in ch.qos.logback.core.joran.spi.Interpreter@18:17 - no applicable action for[maxFileSize], current ElementPath is [[configuration][appender[rollingPolicy][maxFileSize]]ERROR in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@20f5281c - maxFileSize property is mandatory.
Change your configuration as below. maxFileSize
is a sub property of tag timeBasedFileNamingAndTriggeringPolicy
.
<timeBasedFileNamingAndTriggeringPolicy
class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>2MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.