[MyBatis]问题:ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console.

2023-05-20,,

错误信息

ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console.

错误分析

1)状态记录器没有找到log4j2配置文件,将使用默认配置:只将错误记录到控制台。

2)log4j2的jar包是hibernate5、MyBatis框架自带的log4j2,在SSH、SSM中即使自己导入了第三方日志包,系统依然会调用log4j2,缺省默认配置文件 log4j2.xml

解决方案

增加配置文件 log4j2.xml

+ log4j版本:2.9.1

+ 配置文件位置: src/main/resources/log4j2.xml (最终编译后,应放置的位置:/classpath)

<?xml version="1.0" encoding="UTF-8"?>

<Configuration status="warn">
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%m%n" />
</Console>
</Appenders>
<Loggers>
<Root level="INFO">
<AppenderRef ref="Console" />
</Root>
</Loggers>
</Configuration>

参考文献

测试错误ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console.问题的解决

[MyBatis]问题:ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console.的相关教程结束。

《[MyBatis]问题:ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console..doc》

下载本文的Word格式文档,以方便收藏与打印。