Spring云任务默认日志不显示

时间:2017-12-25 20:01:37

标签: spring-boot spring-cloud-task

我是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

修改 当我将弹簧批量启动器添加到我的pom时,日志开始显示正常,并且slf4j警告消失了。我想如果我们只有spring cloud任务,那么slf4j配置就会丢失。是否有任何特定原因将其配置为特定于spring cloud任务的那个?

1 个答案:

答案 0 :(得分:0)

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

相关问题