【问题标题】:Does the logback configuration debug attribute work on logback-spring.xml file?logback 配置调试属性是否适用于 logback-spring.xml 文件?
【发布时间】:2021-02-26 22:25:25
【问题描述】:

我使用的是 Spring Boot 2.4.3,在我的 logback-spring.xml 中设置了 <configuration debug="true">,但控制台没有打印任何状态消息。

我的logback-spring.xml

<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="true">
  <include resource="org/springframework/boot/logging/logback/defaults.xml"/>
  <springProfile name="default">
    <include resource="org/springframework/boot/logging/logback/console-appender.xml"/>
    <root level="INFO">
      <appender-ref ref="CONSOLE"/>
    </root>
  </springProfile>
  <springProfile name="!default">
    <appender name="JSON_CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
      <encoder class="net.logstash.logback.encoder.LogstashEncoder">
        <includeTags>false</includeTags>
      </encoder>
    </appender>
    <root level="INFO">
      <appender-ref ref="JSON_CONSOLE"/>
    </root>
  </springProfile>
</configuration>

我从 Logback documentation 获得了配置。

此配置是否仅适用于logback.xml 文件?

【问题讨论】:

    标签: spring-boot logback


    【解决方案1】:

    配置正常,是我的错,我仔细分析了日志并打印了消息。

    【讨论】:

      猜你喜欢
      • 2018-08-21
      • 2017-05-08
      • 2019-05-31
      • 2017-09-07
      • 2019-01-19
      • 1970-01-01
      • 2021-05-19
      • 2020-09-24
      • 2018-04-06
      相关资源
      最近更新 更多