private final Logger LOGGER  = LoggerFactory.getLogger(TaskSchedulServiceJunit.class);

@Test
public void testLogs(){
System.out.println("This is println message!");
LOGGER.error("error log");
LOGGER.debug("debug log");
LOGGER.info("info log");
}

在classpath路径下获取 STATIC_LOGGER_BINDER_PATH (类org/slf4j/impl/StaticLoggerBinder.class),未获取到。

 该类存在于 slf4j-log4j.jar 下。看看项目是否缺少该包。下面Jar包中有部分是间接依赖slf4j-log4j.jar,如果项目中的jar没有间接依赖slf4j-log4j,就需要单独添加。

eclipse的pom.xml中Dependency Hierarchy可以查看jar的依赖关系:

 本项目使用的slf4j来管理日志,slf4j的使用需要 slf4j-api.jar,还需要slf4j为具体实现所提供的适配器(slf4j-log4j12.jar),以及具体实现记录日志的jar(log4j-1.**.jar)。

 https://blog.csdn.net/jediael_lu/article/details/43854571

01-11 07:37
查看更多