今天在学习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。就可以了

  1.  
    <?xml version="1.0" encoding="UTF-8"?>
  2.  
    <Configuration status="warn">
  3.  
                <Appenders>
  4.  
                            <Console name="Console" target="SYSTEM_OUT">
  5.  
                                        <PatternLayout pattern="[%-5p] %d %c - %m%n" />
  6.  
                            </Console>
  7.  
                            <File name="File" fileName="dist/my.log">
  8.  
                                        <PatternLayout pattern="%m%n" />
  9.  
                            </File>
  10.  
                </Appenders>
  11.  
     
  12.  
                <Loggers>
  13.  
                            <Logger name="mh.sample2.Log4jTest2" level="INFO">
  14.  
                                        <AppenderRef ref="File" />
  15.  
                            </Logger>
  16.  
                            <Root level="INFO">
  17.  
                                        <AppenderRef ref="Console" />
  18.  
                            </Root>
  19.  
                </Loggers>
  20.  
    </Configuration>

这里为什么这样配置就不说了,可以去查阅log4j2的文档。

在次运行程序,控制台没有错误提示了

我果然还是java菜鸟一个啊,这里只是自己的学习记录,哈哈,大神别喷。

原文:http://xtceetg.blog.51cto.com/5086648/1877001

ERROR StatusLogger Log4j2 could not find a logging implementation.的更多相关文章

  1. 使用Log4j2,打包后提示ERROR StatusLogger Log4j2 could not find a logging implementation.

    从Log4j切换到Log4j2,没有打包之前日志输出正常,但是打包后总是提示下面内容: 错误一: ERROR StatusLogger Log4j2 could not find a logging ...

  2. ERROR StatusLogger Log4j2 could not find a logging implementation. Please add log4j-core to the classpath

    问题: ERROR StatusLogger Log4j2 could not find a logging implementation. Please add log4j-core to the ...

  3. ERROR StatusLogger Log4j2 could not find a logging implementation. Please add log4j-core to the classpath. Using SimpleLogger to log to the console...

    Struts2未配置Log4j2.xml报错 Log4j2.xml中的配置 log4j的jar包:log4j-core-2.7.jar log4j2只支持xml和json两种格式的配置,所以配置log ...

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

    ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only err ...

  5. 测试中出现ERROR StatusLogger No log4j2 configuration file

    概述 在hibernate框架搭建完成用log4j2进行测试时,总是出现ERROR StatusLogger No log4j2 configuration file found. Using def ...

  6. Log4j2报错ERROR StatusLogger Unrecognized format specifier

    问题 使用maven-shade-plugin或者maven-assembly-plugin插件把项目打成一个可执行JAR包时,如果你引入了log4j2会出现如下问题: ERROR StatusLog ...

  7. Spring Boot ERROR StatusLogger No Log4j 2 configuration file found

    1. 问题描述 项目之前的 log4j2 配置没问题,把 pom 文件中的 spring-boot-starter-web 依赖删除后,然后启动项目就报错找不到 log4j2.yml 文件. 之前引用 ...

  8. 教你搭建SpringMVC框架( 更新中、附源码)

    一.项目目录结构 二.SpringMVC需要使用的jar包 commons-logging-1.2.jar junit-4.10.jar log4j-api-2.0.2.jar log4j-core- ...

  9. Knowledge_SPA——精研查找算法

    首先保证这一篇分析查找算法的文章,气质与大部分搜索引擎搜索到的文章不同,主要体现在代码上面,会更加高级,会结合到很多之前研究过的内容,例如设计模式,泛型等.这也与我的上一篇面向程序员编程--精研排序算 ...

随机推荐

  1. Cmakelists.txt中配置glew

    在cmakelists.txt中添加: add_library(glew_static STATIC IMPORTED) set_target_properties(glew_static PROPE ...

  2. jQuery show hide方法 二级菜单

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  3. 13 -3 jquery选择器和 jquery动画

    一 选择器: 1 基本选择器 例子: <!--id 类 标签--> <!DOCTYPE html> <html lang="en"> <h ...

  4. et al.

    et al.   英 [ˌet ˈæl]   adv. <拉>以及其他人; [例句]Earlier research in conventional RCS modelling for d ...

  5. CNN网络改善的方法——池化

    一个能降低卷积金字塔中特征图的空间维度,目前为止,我们通过调整步幅,将滤镜每次移动几个像素.图1 从而降低特征图的尺寸.这是降低图像采样率的一种非常有效的方法. 图1 它移除了很多信息,如果我们不采用 ...

  6. ListOfOpenSourcePrograms

    ListOfOpenSourcePrograms Contents Desktop Applications Communication Engineering Educational Financi ...

  7. Angular项目目录结构

    前言:不支持MakeDown的博客园调格式的话,真的写到快o(╥﹏╥)o了,所以老夫还是转战到CSDN吧,这边就不更新啦啦啦~ CSDN地址:https://blog.csdn.net/Night20 ...

  8. 杂项-Java-百科:war-un

    ylbtech-杂项-Java-百科:war-un 1.返回顶部 1. war是一个可以直接运行的web模块,通常用于网站,打成包部署到容器中.以Tomcat来说,将war包放置在其\webapps\ ...

  9. Springboot2 Logback mybatis 打印sql执行语句

    把这个加入到logback.xml 中就可以打印mysql的日志了 <logger name="jdbc.sqltiming" level="debug" ...

  10. laravel5 怎么获取数组形式的数据

    当构建 JSON API 时,您可能常常需要把模型和关联对象转换成数组或JSON.所以Eloquent里已经包含了这些方法.要把模型和已载入的关联对象转成数组,可以使用 toArray方法: $use ...