I am getting error: SLF4J: No SLF4J providers were found. SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See https://www.slf4j.org/codes.html#noProviders for further details.
The error is happening when using log4j-over-slf4j, slf4j-reload4j, or slf4j-log4j12. But everything works just fine with slf4j-simple. How can I use log4j over slf4j?
Here is my App:
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class App {
private final static Logger log = LoggerFactory.getLogger(App.class);
public static void main(String[] args) {
log.error("Success");
}
}
And below is build.gradle.
apply plugin: 'java'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
compile 'org.slf4j:slf4j-api:2.0.7'
compile 'org.slf4j:log4j-over-slf4j:2.0.7'
// compile 'org.slf4j:slf4j-reload4j:2.0.7'
// compile 'org.slf4j:slf4j-log4j12:2.0.7'
// compile 'org.slf4j:slf4j-simple:2.0.7'
}