<!-- 文件输出 --> <appender name="FILECOUT" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>${log.path}/${log.name}</file> <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> <fileNamePattern>${log.path}/${log.name}.%i</fileNamePattern> <!-- 索引最小值,标识%i从1开始 --> <minIndex>1</minIndex> <!-- 索引最大值,标识%i到5结束,始终保留了5个归档文件 --> <maxIndex>5</maxIndex> </rollingPolicy> <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> <!-- 文件大小超过1MB归档 --> <maxFileSize>1MB</maxFileSize> </triggeringPolicy> <encoder> <pattern>%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{80} [%file:%line] %msg %n</pattern> </encoder> </appender>
转载于:https://blog.51cto.com/limeixiong/2051091