Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/332.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/257.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 我从github获取了slf4的源代码,但我可以';我不知道该怎么办_Java_Slf4j - Fatal编程技术网

Java 我从github获取了slf4的源代码,但我可以';我不知道该怎么办

Java 我从github获取了slf4的源代码,但我可以';我不知道该怎么办,java,slf4j,Java,Slf4j,我正在研究slf4j的代码实现。当我提取slf4j的源代码时,如何运行一个简单的测试 我在slf4j的源代码项目中创建了一个新模块。在本模块中,我介绍了slf4japi模块和sl4j simple模块 //我的模块中的代码 公开课演示{ 公共静态void main(字符串[]args){ Logger Logger=LoggerFactory.getLogger(Demo.class); 错误(“哈哈”); } } my pom.xml <?xml version="1.0" encod

我正在研究slf4j的代码实现。当我提取
slf4j
的源代码时,如何运行一个简单的测试

我在slf4j的源代码项目中创建了一个新模块。在本模块中,我介绍了
slf4japi
模块和
sl4j simple
模块

//我的模块中的代码
公开课演示{
公共静态void main(字符串[]args){
Logger Logger=LoggerFactory.getLogger(Demo.class);
错误(“哈哈”);
}
}
my pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <parent>
    <artifactId>slf4j-parent</artifactId>
    <groupId>org.slf4j</groupId>
    <version>1.7.28</version>
  </parent>
  <modelVersion>4.0.0</modelVersion>
  <artifactId>demo</artifactId>
  <dependencies>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-simple</artifactId>
    </dependency>
  </dependencies>
</project>

请尝试以下方法之一以帮助进行故障排除:

  • 使用Java8
  • 在依赖项中指定小于1.8的slf4j版本

您似乎遇到了与
jigsaw

相关的类路径问题,您提到的文档中也提到了错误“加载类失败”。只需仔细检查并应用上面提到的方法。我想它会起作用的。但是,我创建的模块引入了slf4j api模块和slf4j示例模块,但他仍然建议我没有slf4j的具体实现。拉式slf4j版本是1.7.28,使用jdk8。你确定IDEA是使用1.8调试的吗?检查您的项目JDK设置。以前我在github上获得了slf4j 1.7.28,但现在我在github上获得了slf4j 1.7.24,现在它正在工作。非常感谢您的帮助。我认为我的想法有问题,我正在试图找到答案。@L.gen调试使用指定的JDK和类路径时启动配置。这与项目设置中的JDK不同。我在IDEA的项目结构->项目中将JDK设置为1.8。
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.