比较完整配置文件如下:
当新建一个基于springboot的单项目时只需要把如下配置复制到项目根目录下\src\main\resources\logback-spring.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xml>
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<contextName>sms</contextName>
<!--设置系统日志目录-->
<property name="log.path" value="log" />
<!--最多保留15天log-->
<property name="log.maxHistory" value="15" />
<property name="log.pattern" value="%d{HH:mm:ss.SSS} %contextName [%thread] %-5level %logger{36} - %msg%n" />
<!--输出到控制台-->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
&l