我使用的是Spring Boot2.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文件?
发布于 2021-02-27 06:33:24
配置工作正常,这是我的错,我仔细分析了日志,并打印了消息。
https://stackoverflow.com/questions/66393535
复制相似问题