log4j:WARN请正确初始化log4j系统 [英] log4j:WARN Please initialize the log4j system properly

查看:2332
本文介绍了log4j:WARN请正确初始化log4j系统的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试学习硒。



我收到以下错误消息:


log4j:WARN找不到logger
(org.apache.http.client.protocol.RequestAddCookies)的appender。 log4j:WARN请
正确初始化log4j系统。 log4j:WARN请参阅
http://logging.apache.org/ log4j / 1.2 / faq.html #noconfig 了解更多信息。


所以,我已经下载了文件 log4j.properties 我已经google了它并试图在Eclipse中以不同的方式实现该文件,但没有任何结果。我看到有人在说:



将一个名为log4j.properties的文件放在类路径的根目录中:

  log4j.rootLogger = ALL,Console 
log4j.appender.Console = org.apache.log4j.ConsoleAppender
log4j.appender.Console .layout = org.apache.log4j.PatternLayout
log4j.appender.Console.layout.conversionPattern =%m%n

不需要其他任何东西。 Log4j会发现它并进行自我配置。



但它们是什么意思你的类路径中的? / p>

我在Eclipse工作。那么如何在Eclipse中找到类路径的根?

解决方案

看起来你需要添加log4j的位置.properties或log4j.xml文件到Eclipse中的Classpath。



确保您的项目在Eclipse中打开,然后单击Eclipse顶部的运行菜单并单击以下内容:



运行 - >运行配置 - >类路径(选项卡) - >用户条目 - >高级(右侧按钮) - >添加文件夹 - >然后导航到包含log4j.properties文件的文件夹



应用 - >运行



错误消息不应再出现了。


I am trying to learn selenium.

I get following error message:

log4j:WARN No appenders could be found for logger (org.apache.http.client.protocol.RequestAddCookies). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

So, I have downloaded the file log4j.properties and I have googled on it and tried to implement the file in different ways in Eclipse but nothing worked out. I see that someone is saying:

Put a file named log4j.properties in the root of your classpath:

log4j.rootLogger = ALL, Console
log4j.appender.Console=org.apache.log4j.ConsoleAppender
log4j.appender.Console.layout=org.apache.log4j.PatternLayout
log4j.appender.Console.layout.conversionPattern=%m%n

Nothing else is needed. Log4j will discover it and configure itself.

But what do they mean by "in the root of your classpath"?

I work in Eclipse. So how do I find the root of the classpath in Eclipse?

解决方案

It looks like you need to add the location of your log4j.properties or log4j.xml file to the Classpath in Eclipse.

Make sure your project is open in Eclipse, then click on the "Run" menu at the top of Eclipse and click on the following:

Run -> Run Configurations -> Classpath (tab) -> User Entries -> Advanced (button on the right) -> Add Folders ->then navigate to the folder that contains your log4j.properties file

Apply -> Run

The error message should no longer appear.

这篇关于log4j:WARN请正确初始化log4j系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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