【发布时间】: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