【问题标题】:Spring cloud task default log not displayingSpring Cloud 任务默认日志不显示
【发布时间】:2018-06-06 21:17:49
【问题描述】:

我是 Spring Cloud Task 的新手。我正在尝试设置 Hello World 示例应用程序。根据example here,它运行并且一切看起来都很好。 但是我看到下面的输出。我看到一些 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

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

【问题讨论】:

    标签: spring-boot spring-cloud-task


    【解决方案1】:

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

    【讨论】:

    • 我理解并且我已经能够看到我是否进行了这些更改。我的问题更多的是为什么我们看不到默认实现?就像我们在春季批量启动器中看到的那样。像这样设计云任务有什么具体原因吗?
    猜你喜欢
    • 1970-01-01
    • 2022-09-06
    • 2015-11-03
    • 2010-12-30
    • 2022-12-12
    • 2016-08-01
    • 2019-06-03
    • 2012-02-14
    • 2022-06-13
    相关资源
    最近更新 更多