我是靠谱客的博主 落寞冬天,这篇文章主要介绍ERROR StatusLogger Log4j2 could not find a logging implementation.,现在分享给大家,希望可以做个参考。
今天在学习structs2 2.5.5的版本的时候碰到2个问题。第一个网上下的包里面差log4j-core这个包。
虽然程序可以运行,但控制台会报这个错误。
ERROR StatusLogger Log4j2 could not find a logging implementation. Please add log4j-core to the classpath. Using SimpleLogger to log to the console...
在添加了这个包后在再次运行程序。
控制台提示
ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console.
找不到log4j2的配置文件
网上google之。找到文档。原来只要在classpath下的目录添加一个log4j2.xml。就可以了
-
<?xml version="1.0" encoding="UTF-8"?>
-
<Configuration status="warn">
-
<Appenders>
-
<Console name="Console" target="SYSTEM_OUT">
-
<PatternLayout pattern="[%-5p] %d %c - %m%n" />
-
</Console>
-
<File name="File" fileName="dist/my.log">
-
<PatternLayout pattern="%m%n" />
-
</File>
-
</Appenders>
-
-
<Loggers>
-
<Logger name="mh.sample2.Log4jTest2" level="INFO">
-
<AppenderRef ref="File" />
-
</Logger>
-
<Root level="INFO">
-
<AppenderRef ref="Console" />
-
</Root>
-
</Loggers>
-
</Configuration>
这里为什么这样配置就不说了,可以去查阅log4j2的文档。
在次运行程序,控制台没有错误提示了
我果然还是java菜鸟一个啊,这里只是自己的学习记录,哈哈,大神别喷。
原文:http://xtceetg.blog.51cto.com/5086648/1877001
最后
以上就是落寞冬天最近收集整理的关于ERROR StatusLogger Log4j2 could not find a logging implementation.的全部内容,更多相关ERROR内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复