0

我是 Spring Cloud Task 的新手。我正在尝试设置 Hello World 示例应用程序。它运行并且按照这里的示例一切似乎都很好。但是我看到下面的输出。我看到一些 slf4j 警告。但是我的理解是 spring boot 应该提供默认设置。为什么我看到不同的日志文件有什么原因?

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.

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v1.5.9.RELEASE)

Hello World!

我的application.properties已经有了这个。

logging.level.org.springframework.cloud.task=DEBUG
spring.application.name=demo

编辑 当我在我的 pom 中添加 spring 批处理启动器时,日志开始显示正常并且 slf4j 警告消失了。如果我们只有 spring 云任务,我猜想 slf4j 配置会丢失。是否有任何特定原因将其配置为特定于 Spring Cloud 任务?

4

1 回答 1

0

根据 SLF4J 文档(https://www.slf4j.org/codes.html#StaticLoggerBinder),该错误是由于您没有添加日志记录impl。您可以通过添加用于日志记录的 Spring Boot Starter 或添加您自己的日志记录依赖项来解决此问题。

于 2017-12-26T16:47:02.130 回答