springboot log4j2配置

来源:互联网 发布:matlab数组分号 编辑:程序博客网 时间:2024/05/01 01:24

1、修改pom文件

<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId><exclusions><!-- 发布时去除内置tomcat --><exclusion><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-tomcat</artifactId></exclusion><exclusion><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-logging</artifactId></exclusion></exclusions></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-log4j2</artifactId></dependency>


2、加入log4j2.xml

在src/main/resources中加入配置文件,详细配置不在赘述

3、修改application.properties

logging.config=classpath:log4j2.xml


大功告成!

1 0
原创粉丝点击