【问题标题】:How to extend Springboot logback configuration? (default.xml apparently not available)如何扩展 Springboot logback 配置? (default.xml 显然不可用)
【发布时间】:2019-09-08 02:28:34
【问题描述】:

我正在尝试关注the Springboot logback customisation instructions

我想获得基本的默认行为(所以我可以添加它)。

那个页面说:

A typical custom logback.xml file would look something like this:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <include resource="org/springframework/boot/logging/logback/default.xml"/>
    <include resource="org/springframework/boot/logging/logback/console-appender.xml" />
    <root level="INFO">
        <appender-ref ref="CONSOLE" />
    </root>
    <logger name="org.springframework.web" level="DEBUG"/>
</configuration>

...所以我尝试了,我得到了

ch.qos.logback.core.joran.action.IncludeAction 中的警告 - 不能 找到对应的资源 [org/springframework/boot/logging/logback/default.xml]

我的 build.gradle 中有很多:

dependencies {
    implementation(
            'org.springframework.boot:spring-boot-starter-web',
            'org.springframework.boot:spring-boot-starter-logging',

...理论上我认为 starter-web 本身就足够了?

我错过了什么?

【问题讨论】:

    标签: java spring-boot logback


    【解决方案1】:

    似乎是文档中的错字。

    该文件存在于 spring-boot-X.X.X.jar 文件中,但名称为 defaults.xml,而不是 default.xml

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-12-08
      • 2018-03-27
      • 2021-05-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多