今天在学习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. 2017 ACM/ICPC Asia Regional Shenyang Online:number number number hdu 6198【矩阵快速幂】

    Problem Description We define a sequence F: ⋅ F0=0,F1=1;⋅ Fn=Fn−1+Fn−2 (n≥2). Give you an integer k, ...

  2. hdu 1025 lis 注意细节!!!【dp】

    感觉这道题浪费了我半个小时的生命......哇靠!原来输出里面当len=1时是road否则是roads!!! 其实做过hdu 1950就会发现这俩其实一样,就是求最长上升子序列.我用结构体记录要连线的 ...

  3. HDU 5673 Robot【卡特兰数】

    题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5673 题意: 有一个机器人位于坐标原点上.每秒钟机器人都可以向右移到一个单位距离,或者在原地不动.如 ...

  4. TreeSet之用外部比较器实现自定义有序(重要)

    Student.java package com.sxt.set5; public class Student{ private String name; private int age; priva ...

  5. H5页面IOS中键盘弹出导致点击错位的问题

    IOS在点击输入框弹出键盘  键盘回缩 后 定位没有相应改变  还有  textarea 也会弹出键盘 $("input").blur(function() { console.l ...

  6. Python从文件中读取内容,包含中文和英文

    读取文件内容使要和保存文件时的格式一致 以UTF-8格式保存文件,如: 读取: 在.py起始行写入:#-*- coding:utf-8 -*- filename = raw_input(u" ...

  7. plt.figure()的使用

    版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明.本文链接:https://blog.csdn.net/m0_37362454/article/d ...

  8. TCP/IP 、HTTP和SOCKET

    TCP/IP协议概念 TCP/IP(Transmission Control Protocol/Internet Protocol)的简写,中文译名为传输控制协议/因特网互联协议,又叫网络通讯协议,这 ...

  9. HZOJ string

    正解炸了…… 考试的时候想到了正解,非常高兴的打出来了线段树,又调了好长时间,对拍了一下发现除了非常大的点跑的有点慢外其他还行.因为复杂度算着有点高…… 最后正解死于常数太大……旁边的lyl用同样的算 ...

  10. H3C Telnet配置例子