我收到错误: SLF4J:未找到 SLF4J 提供程序。 SLF4J:默认为无操作 (NOP) 记录器实现 SLF4J:有关详细信息,请参阅https://www.slf4j.org/codes.html#noProviders。
使用 log4j-over-slf4j、slf4j-reload4j 或 slf4j-log4j12 时出现错误。但是使用 slf4j-simple 一切正常。 我如何使用 log4j 而不是 slf4j?
这是我的应用程序:
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");
}
}
下面是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'
}