spring-boot using log4j

Disclaimer: This article is a blogger original article, shall not be reproduced without the bloggers allowed. https://blog.csdn.net/qq_36209121/article/details/78815038

log4j Configuration

spring-boot is used by default logback, due to the habit of using log4j, is to use the following log4j configuration.

The default configuration log 1 Ignore the spring-boot;

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter</artifactId>

    <exclusions>
      <exclusion>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-logging</artifactId>
      </exclusion>
   </exclusions>
</dependency>

Add 2 dependent log4j

<dependency>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-starter-log4j</artifactId>
   <version>1.3.0.M1</version>
</dependency>
<dependency>
    <groupId>log4j</groupId>
    <artifactId>log4j</artifactId>
    <version>1.2.16</version>
</dependency>

Guess you like

Origin blog.csdn.net/qq_36209121/article/details/78815038