简体   繁体   English

Spring Boot 2.2.6 没有为 Logback 的 SizeAndTimeBasedRollingPolicy 提供上下文

[英]Spring Boot 2.2.6 No context given for SizeAndTimeBasedRollingPolicy at Logback

When I use these configuration:当我使用这些配置时:

logging:
  file:
    name: app.log
    total-size-cap: 50MB
    max-size: 2MB
    max-history: 7
    path: logs

I get this information at application startup:我在应用程序启动时收到此信息:

LOGBACK: No context given for c.q.l.core.rolling.SizeAndTimeBasedRollingPolicy@1818544933

When I create a dummy logback-spring.xml file there are no errors but application properties are ignored:当我创建一个虚拟的logback-spring.xml文件时,没有错误但应用程序属性被忽略:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <include resource="org/springframework/boot/logging/logback/defaults.xml" />
</configuration>

What I am missing at the configuration?我在配置中缺少什么?

Looks like a legitimate issue.看起来像一个合法的问题。 https://github.com/spring-projects/spring-boot/issues/21056 has a bugfix targeted to the next 2.2.x release. https://github.com/spring-projects/spring-boot/issues/21056有一个针对下一个 2.2.x 版本的错误修复。 Sounds like adding logback-spring.xml to y听起来像是将 logback-spring.xml 添加到 y

Firsyly, you can not use both 'name' and 'path'.首先,您不能同时使用“名称”和“路径”。 It's either of them.这是他们中的任何一个。 Secondly, you need to set logging.config=/path/to/logback.xml其次,需要设置logging.config=/path/to/logback.xml

Here is my source of information: https://docs.spring.io/spring-boot/docs/current/reference/html/spring-boot-features.html#boot-features-logging-file-output这是我的信息来源: https : //docs.spring.io/spring-boot/docs/current/reference/html/spring-boot-features.html#boot-features-logging-file-output

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM