Getting error -Failed to load class "org.slf4j.impl.StaticLoggerBinder" in Selenium Maven project

1.3k Views Asked by At

I am using below code with WebDriverManager-

package MySelenium.mySelenium;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import io.github.bonigarcia.wdm.WebDriverManager;

public class TestSelenium {

    public static void main(String[] args) {

        WebDriverManager.chromedriver().setup();
        WebDriver driver = new ChromeDriver();
        driver.get("https://www.demoqa.com");
        driver.quit();
    }

}

Getting below message when I run my program, although it's not impacting my execution. It ran successfully but with this message-

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Starting ChromeDriver 89.0.4389.23

I searched on stack overflow and found that if I add below two jars in POM.xml, error will be removed, so I have added these two jars but now started getting different message-

<artifactId>slf4j-log4j12</artifactId>
<artifactId>slf4j-api</artifactId>

Message now getting-

log4j:WARN No appenders could be found for logger (io.github.bonigarcia.wdm.cache.ResolutionCache).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Starting ChromeDriver 89.0.4389.23

Kindly help to remove these messages

1

There are 1 best solutions below

2
On

You can add the below jars files

org.slf4j

slf4j-api

1.7.5

org.slf4j

slf4j-log4j12

1.7.5