1
votes

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?

3

3 Answers

6
votes

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.

0
votes

Did you simply try to put it in your source folder? It should be copied automatically to your deployment folder on build. If you already tried, it may be your deployment rules that skip *.properties files...

Hope that will help you

0
votes

Delete the log4j.rar from your external Libraries

steps: Right click on src-->BuildPath-->Configure Buildpath-->Libraries-->Select Log4j.rar and Remove it.

For report generation, you need to add log4j for simply executing the script no need to add log4j.

Hope this will solve your problem