Unable to write to a log file using Log4j

Hello All,

I am unable to write to a log file using Log4j jars. I imported all log4j jars onto the project. When i execute my script, i got the following exception.

Exception in thread “main” java.lang.NoClassDefFoundError: org/slf4j/Logger

kaarthiiik Default Asked on August 14, 2016 in Selenium WebDriver.
Add Comment
3 Answer(s)

Kaarthiiik, You seem to be missing some Jar files. Please go through the tutorials here to get the complete list of Log4J file

http://toolsqa.com/selenium-webdriver/log4j-logging/
Virender

Virender Singh Professor Answered on August 16, 2016.
Add Comment

Ggg

Binit Default Answered on September 4, 2016.
Add Comment

See you need to download log4j.jar…..then set the path…or enable it to your project.
Again download log4j.xml from google.

public class myclass{

void myfile(){

Logger log=logger.getlogger(“myclass”)
PropertyConfigurator.configure(“log4j.properties”);
Webdriver driver=new firefox();
driver. get(“http://google.com”);
}
}…hope this will help.

}

Binit Default Answered on September 4, 2016.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.