找不到log4j2配置文件.使用默认配置:仅将错误记录到控制台 [英] No log4j2 configuration file found. Using default configuration: logging only errors to the console

查看:1382
本文介绍了找不到log4j2配置文件.使用默认配置:仅将错误记录到控制台的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

$ java -Dlog4j.configuration=file:///path/to/your/log4j2.xml -jar /path/to/your/jar_file.jar

写到控制台,您将得到

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

但是,看起来配置文件也已找到并且无法解析:

But, it also looks like the configuration file has been found and was not parsable:

    log4j:WARN Continuable parsing error 2 and column 31
    log4j:WARN Document root element "Configuration", must match DOCTYPE root "null".
    log4j:WARN Continuable parsing error 2 and column 31
    log4j:WARN Document is invalid: no grammar found.
    log4j:ERROR DOM element is - not a <log4j:configuration> element.
    log4j:WARN No appenders could be found for logger (kafka.utils.VerifiableProperties).
    log4j:WARN Please initialize the log4j system properly.
    log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

推荐答案

一段时间以来,我一直在处理此问题.我已经按照本文中所述更改了所有内容,甚至认为发生了错误.在这种情况下,请确保在更改.xml或.properties文件中的设置时清理项目. 在日食环境中.选择项目->清理

I have been dealing with this problem for a while. I have changed everything as described in this post and even thought error occured. In that case make sure that you clean the project when changing settings in .xml or .properties file. In eclipse environment. Choose Project -> Clean

这篇关于找不到log4j2配置文件.使用默认配置:仅将错误记录到控制台的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆