log4j配置文件詳解?
<properties>
<slf4j.version>1.7.30</slf4j.version>
<log4j2.version>2.15.0</log4j2.version>
</properties>
,今天小編就來說說關于log4j配置文件詳解?下面更多詳細答案一起來看看吧!
<properties>
<slf4j.version>1.7.30</slf4j.version>
<log4j2.version>2.15.0</log4j2.version>
</properties>
<!-- Log4j2 整體升級配置 -->
<!-- slf4j和log4j2 的整合綁定)-->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<!-- note:log4j1用的是slf4j-log4j12,此處注意不一樣-->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>2.15.0</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.15.0</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.15.0</version>
</dependency>
<!-- 開戶異步日志,需要依賴這個jar包-->
<dependency>
<groupId>com.lmax</groupId>
<artifactId>disruptor</artifactId>
<version>3.4.4</version>
</dependency>
<!-- /slf4j和log4j2 的整合綁定-->
<!-- 可選包,根據實際情況橋接 -->
<!-- 後向兼容:使用Log4j2實現log2j1.x的接口 -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-1.2-api</artifactId>
<version>${log4j2.version}</version>
</dependency>
<!-- Jakarta Commons Logging 把jcl的日志輸出重定向到 SLF4J -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>${slf4j.version}</version>
</dependency>
<!-- 把log4j的日志重定向到slf4j 注意是over不是to -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
<version>${slf4j.version}</version>
</dependency>
<!-- /可選包 -->
<!-- note:千萬别引入 slf4j-log4j12;log4j-to-slf4j;會導緻無限循環-->
<!-- / Log4j2 整體升級配置 -->
更多精彩资讯请关注tft每日頭條,我们将持续为您更新最新资讯!