gpt4 book ai didi

java - 如何扩展Springboot logback配置? (default.xml 显然不可用)

转载 作者:行者123 更新时间:2023-11-29 08:21:21 24 4
gpt4 key购买 nike

我正在尝试关注 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>

...所以我试过了,我明白了

WARN in ch.qos.logback.core.joran.action.IncludeAction - Could not find resource corresponding to [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 本身就足够了吗?

我错过了什么?

最佳答案

似乎是文档中的错字。

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

enter image description here

关于java - 如何扩展Springboot logback配置? (default.xml 显然不可用),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57838767/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com