Spring Boot 2.2.6未在Logback时提供SizeAndTimeBasedRollingPolicy的上下文

问题描述 投票:0回答:1

当我使用这些配置时:

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

我在应用程序启动时获得此信息:

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

创建虚拟logback-spring.xml文件时没有错误,但是应用程序属性被忽略:

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

我在配置中缺少什么?

java spring spring-boot logback spring-logback
1个回答
0
投票

当然,您不能同时使用'name'和'path'。是他们两个。其次,您需要设置logging.config = / path / to / logback.xml

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

© www.soinside.com 2019 - 2024. All rights reserved.