ERROR StatusLogger Log4j2 could not find a logging implementation.
2024-10-08 03:36:20
今天在学习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
最新文章
- IIS 设置默认首页静态页,无静态页,走路由
- 操作系统开发系列—13.c.进程之中断重入
- 彻底解决Android SDK Manager更新慢的问题
- peak num
- ubuntu下配置hosts
- 【原创】【ViewFlow+GridView】Parameter must be a descendant of this view问题分析
- 使用TypeDescriptor给类动态添加Attribute
- vs工程链接出现error LNK2005...already defined
- IE比Chrome强的一个地方
- rsync 只是测试,请看下一篇
- Linux - 简明Shell编程14 - 操作符(Operator)
- 1.5 sleep()方法
- vitual dom实现(转)
- linux下GPRS模块使用AT命令实现拨接电话,发中英文短信
- CentOS 7.0关闭服务器的防火墙服务命令
- react ref获取dom对象
- 学习MFC的建议
- node+mongoose使用例子
- Oracle PLSQL Demo - 05.WHILE循环[WHILE LOOP]
- 没有Home键之后的iPhone会是什么样子?