From ca1d0edd566e624febfc3820bfcb9e5f832176a8 Mon Sep 17 00:00:00 2001 From: zhangjf Date: Sun, 22 Feb 2026 20:52:46 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=A7=BB=E9=99=A4=E5=90=AF=E5=8A=A8?= =?UTF-8?q?=E5=91=BD=E4=BB=A4=E4=B8=AD=E7=9A=84=E6=97=A5=E5=BF=97=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F=E5=8F=82=E6=95=B0=EF=BC=8C=E9=81=BF=E5=85=8Dshell?= =?UTF-8?q?=E8=A7=A3=E6=9E=90=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 问题: - LOG_PATTERN包含特殊字符(百分号、方括号等) - 通过-D参数传递导致shell解析错误 修改: - start.sh: 移除LOG_LEVEL_ROOT/LOG_LEVEL_APP/LOG_PATTERN参数 只保留logging.file.path用于指定日志目录 - logback-spring.xml: 日志格式改为直接配置 使用而非 - env.properties: 更新注释说明日志配置由logback管理 优势: - 启动命令简洁,无特殊字符解析问题 - 日志配置统一在logback-spring.xml管理 - 避免shell注入风险 --- fund-cust/src/main/resources/logback-spring.xml | 7 ++++--- fund-exp/src/main/resources/logback-spring.xml | 7 ++++--- fund-file/src/main/resources/logback-spring.xml | 7 ++++--- fund-gateway/src/main/resources/logback-spring.xml | 7 ++++--- fund-proj/src/main/resources/logback-spring.xml | 7 ++++--- fund-receipt/src/main/resources/logback-spring.xml | 7 ++++--- fund-report/src/main/resources/logback-spring.xml | 7 ++++--- fund-req/src/main/resources/logback-spring.xml | 7 ++++--- fund-sys/src/main/resources/logback-spring.xml | 5 +++-- scripts/env.properties | 7 ++++--- scripts/start.sh | 6 +----- 11 files changed, 40 insertions(+), 34 deletions(-) diff --git a/fund-cust/src/main/resources/logback-spring.xml b/fund-cust/src/main/resources/logback-spring.xml index 3184538..475822e 100644 --- a/fund-cust/src/main/resources/logback-spring.xml +++ b/fund-cust/src/main/resources/logback-spring.xml @@ -2,12 +2,13 @@ - + - + + + diff --git a/fund-exp/src/main/resources/logback-spring.xml b/fund-exp/src/main/resources/logback-spring.xml index 3184538..375be32 100644 --- a/fund-exp/src/main/resources/logback-spring.xml +++ b/fund-exp/src/main/resources/logback-spring.xml @@ -2,12 +2,13 @@ - + - + + + diff --git a/fund-file/src/main/resources/logback-spring.xml b/fund-file/src/main/resources/logback-spring.xml index 3184538..c439ff9 100644 --- a/fund-file/src/main/resources/logback-spring.xml +++ b/fund-file/src/main/resources/logback-spring.xml @@ -2,12 +2,13 @@ - + - + + + diff --git a/fund-gateway/src/main/resources/logback-spring.xml b/fund-gateway/src/main/resources/logback-spring.xml index 3184538..77ef818 100644 --- a/fund-gateway/src/main/resources/logback-spring.xml +++ b/fund-gateway/src/main/resources/logback-spring.xml @@ -2,12 +2,13 @@ - + - + + + diff --git a/fund-proj/src/main/resources/logback-spring.xml b/fund-proj/src/main/resources/logback-spring.xml index 3184538..a8abb2c 100644 --- a/fund-proj/src/main/resources/logback-spring.xml +++ b/fund-proj/src/main/resources/logback-spring.xml @@ -2,12 +2,13 @@ - + - + + + diff --git a/fund-receipt/src/main/resources/logback-spring.xml b/fund-receipt/src/main/resources/logback-spring.xml index 3184538..76e7288 100644 --- a/fund-receipt/src/main/resources/logback-spring.xml +++ b/fund-receipt/src/main/resources/logback-spring.xml @@ -2,12 +2,13 @@ - + - + + + diff --git a/fund-report/src/main/resources/logback-spring.xml b/fund-report/src/main/resources/logback-spring.xml index 3184538..4af285e 100644 --- a/fund-report/src/main/resources/logback-spring.xml +++ b/fund-report/src/main/resources/logback-spring.xml @@ -2,12 +2,13 @@ - + - + + + diff --git a/fund-req/src/main/resources/logback-spring.xml b/fund-req/src/main/resources/logback-spring.xml index 3184538..abcb6b5 100644 --- a/fund-req/src/main/resources/logback-spring.xml +++ b/fund-req/src/main/resources/logback-spring.xml @@ -2,12 +2,13 @@ - + - + + + diff --git a/fund-sys/src/main/resources/logback-spring.xml b/fund-sys/src/main/resources/logback-spring.xml index 3184538..1bde0b7 100644 --- a/fund-sys/src/main/resources/logback-spring.xml +++ b/fund-sys/src/main/resources/logback-spring.xml @@ -6,9 +6,10 @@ - + + + diff --git a/scripts/env.properties b/scripts/env.properties index eb7fa2e..636928f 100644 --- a/scripts/env.properties +++ b/scripts/env.properties @@ -64,15 +64,16 @@ FILE_STORAGE_MAX_BYTES=52428800 # -------------------------------------------- # 日志配置(由logback-spring.xml统一管理) +# 以下参数仅供参考,实际配置在logback-spring.xml中 # -------------------------------------------- -# 日志文件路径 +# 日志文件路径(由启动脚本LOG_HOME决定) LOG_PATH=/datacfs/applogs # 根日志级别 LOG_LEVEL_ROOT=INFO # 应用包日志级别 LOG_LEVEL_APP=DEBUG -# 日志格式 -LOG_PATTERN=%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{traceId:-}][%X{spanId:-}] %-5level %logger{50} - %msg%n +# 日志格式(已在logback-spring.xml中配置) +# LOG_PATTERN=%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{traceId:-}][%X{spanId:-}] %-5level %logger{50} - %msg%n # -------------------------------------------- # 多租户路由配置 diff --git a/scripts/start.sh b/scripts/start.sh index 614945c..87b0b1a 100755 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -59,12 +59,8 @@ PID_FILE="${APP_HOME}/${INSTANCE_NAME}.pid" # JVM参数(可通过环境变量覆盖) JAVA_OPTS="${JAVA_OPTS:--Xms256m -Xmx512m -XX:+UseG1GC -XX:MaxGCPauseMillis=200}" -# 日志参数(从env.properties读取或使用默认值) +# 日志目录参数(其他日志配置在application.yml/logback-spring.xml中) LOG_OPTS="-Dlogging.file.path=${LOG_HOME}" -LOG_OPTS="$LOG_OPTS -Dspring.application.name=${APP_NAME}" -LOG_OPTS="$LOG_OPTS -Dlogging.level.root=${LOG_LEVEL_ROOT:-INFO}" -LOG_OPTS="$LOG_OPTS -Dlogging.level.app=${LOG_LEVEL_APP:-DEBUG}" -LOG_OPTS="$LOG_OPTS -Dlogging.pattern.console=${LOG_PATTERN}" # 多租户参数 TENANT_OPTS=""