集成Slf4j

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

 <dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-api</artifactId>
    <version>1.7.25</version>
</dependency>
<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-log4j12</artifactId>
    <version>1.7.25</version>
</dependency>
      
複製代碼
log4j.rootLogger=DEBUG,stdout,err

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.threshold=INFO
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss.SSS} %-5p --- [%20t] %c{1}:%L - %m%n

log4j.appender.err=org.apache.log4j.DailyRollingFileAppender
log4j.appender.err.threshold=ERROR
log4j.appender.err.Append=true
log4j.appender.err.File=F:/logs/error.log
log4j.appender.err.DatePattern='.'yyyy-MM-dd
log4j.appender.err.layout=org.apache.log4j.PatternLayout
log4j.appender.err.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss.SSS} %-5p --- [%20t] %c{1}:%L - %m%n
複製代碼
相關文章
相關標籤/搜索