springboot输出日志到文件配置
2021-06-28 23:06
标签:输出 code count filter class pat core ssi back 新建logback-spring.xml,内容如下: springboot输出日志到文件配置 标签:输出 code count filter class pat core ssi back 原文地址:https://www.cnblogs.com/zhuyuehua/p/9648107.htmlxml version="1.0" encoding="UTF-8"?>
configuration scan="true" scanPeriod="60 seconds">
property name="ENCODER_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{80} - %msg%n"/>
contextName>scfs-accountcontextName>
property name="LOG_HOME" value="D://log" />
property name="APPDIR" value="logs" />
appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
Pattern>${ENCODER_PATTERN}Pattern>
encoder>
filter class="ch.qos.logback.classic.filter.ThresholdFilter">
level>debuglevel>
filter>
appender>
appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
fileNamePattern>${LOG_HOME}/%d{yyyy-MM-dd}.logfileNamePattern>
maxHistory>30maxHistory>
rollingPolicy>
encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
pattern>${ENCODER_PATTERN}pattern>
encoder>
appender>
springProfile name="test,pro">
root level="INFO">
appender-ref ref="FILE"/>
root>
springProfile>
springProfile name="dev">
root level="INFO">
appender-ref ref="STDOUT"/>
root>
springProfile>
configuration>