1. 测试环境:创建logback-test.xml,使用固定配置

2. 生产环境:修改logback.xml,移除springProperty依赖,改用固定属性值
This commit is contained in:
2025-07-25 10:50:05 +08:00
parent a67c5de69d
commit 7336a0aaa8
2 changed files with 144 additions and 3 deletions

View File

@@ -2,9 +2,10 @@
<configuration scan="true" scanPeriod="20 seconds" debug="false">
<include resource="org/springframework/boot/logging/logback/defaults.xml" />
<springProperty scope="context" name="log.projectName" source="spring.application.name" defaultValue="entrance"/>
<springProperty scope="context" name="logCommonLevel" source="log.commonLevel" defaultValue="info"/>
<springProperty scope="context" name="logHomeDir" source="log.homeDir" defaultValue="D:\logs"/>
<!-- 直接使用固定配置避免Spring配置解析时机问题 -->
<property name="log.projectName" value="entrance"/>
<property name="logCommonLevel" value="info"/>
<property name="logHomeDir" value="D:\logs"/>
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" />
<conversionRule conversionWord="wex"