一.添加Maven依赖包
这个版本添加了parent就引用了其他包,不要额外添加
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.4.RELEASE</version>
</parent>
二.在resource下面创建 logback-spring.xml 文件,spring官网推荐这个名字,这样就不用在配置文件里面配置了
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<include
resource="org/springframework/boot/logging/logback/defaults.xml" />
<include
resource="org/springframework/boot/logging/logback/console-appender.xml" />
<appender name="FILE"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>${LOG_PATH}${LOG_FILE}</File>
<encoder>
<pattern>%date [%level] [%thread] %logger{60} [%fil