refactor: 统一日志配置到logback-spring.xml

- logback-spring.xml从环境变量读取日志级别和格式
- 移除各服务application.yml中的logging配置
- env.properties添加LOG_PATH、LOG_LEVEL_ROOT、LOG_LEVEL_APP参数
- 启动脚本start.sh传递日志相关JVM参数
- assembly.xml将env.properties打包到conf目录
This commit is contained in:
zhangjf 2026-02-22 15:36:04 +08:00
parent cb0affa2cf
commit faded43266
21 changed files with 204 additions and 139 deletions

View File

@ -15,11 +15,20 @@
<include>stop.sh</include>
<include>restart.sh</include>
<include>status.sh</include>
<include>env.properties</include>
</includes>
<fileMode>0755</fileMode>
</fileSet>
<!-- conf目录 - 环境变量配置 -->
<fileSet>
<directory>${project.basedir}/../scripts</directory>
<outputDirectory>conf</outputDirectory>
<includes>
<include>env.properties</include>
</includes>
<fileMode>0644</fileMode>
</fileSet>
<!-- conf目录 - 配置文件排除docker相关 -->
<fileSet>
<directory>src/main/resources</directory>

View File

@ -41,12 +41,6 @@ mybatis-plus:
logic-delete-value: 1
logic-not-delete-value: 0
logging:
level:
com.fundplatform.cust: DEBUG
pattern:
console: "${LOG_PATTERN:%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n}"
# 多租户路由配置
tenant:
routing:

View File

@ -1,14 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<!-- 定义日志文件路径 -->
<property name="LOG_PATH" value="./logs"/>
<property name="APP_NAME" value="fund-cust"/>
<!-- 从环境变量/系统属性读取配置 -->
<springProperty scope="context" name="APP_NAME" source="spring.application.name" defaultValue="fund-sys"/>
<springProperty scope="context" name="LOG_PATH" source="logging.file.path" defaultValue="/datacfs/applogs"/>
<springProperty scope="context" name="LOG_LEVEL_ROOT" source="logging.level.root" defaultValue="INFO"/>
<springProperty scope="context" name="LOG_LEVEL_APP" source="logging.level.app" defaultValue="DEBUG"/>
<springProperty scope="context" name="LOG_PATTERN" source="logging.pattern.console"
defaultValue="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{traceId:-}][%X{spanId:-}] %-5level %logger{50} - %msg%n"/>
<!-- 控制台输出 -->
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{traceId:-}][%X{spanId:-}] %-5level %logger{50} - %msg%n</pattern>
<pattern>${LOG_PATTERN}</pattern>
<charset>UTF-8</charset>
</encoder>
</appender>
@ -17,7 +21,7 @@
<appender name="FILE_INFO" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_PATH}/${APP_NAME}/info.log</file>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{traceId:-}][%X{spanId:-}] %-5level %logger{50} - %msg%n</pattern>
<pattern>${LOG_PATTERN}</pattern>
<charset>UTF-8</charset>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
@ -38,7 +42,7 @@
<appender name="FILE_ERROR" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_PATH}/${APP_NAME}/error.log</file>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{traceId:-}][%X{spanId:-}] %-5level %logger{50} - %msg%n</pattern>
<pattern>${LOG_PATTERN}</pattern>
<charset>UTF-8</charset>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
@ -95,16 +99,23 @@
<appender-ref ref="FILE_AOP"/>
</logger>
<!-- 应用包日志级别控制 -->
<logger name="com.fundplatform" level="${LOG_LEVEL_APP}" additivity="false">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="FILE_INFO"/>
<appender-ref ref="FILE_ERROR"/>
</logger>
<!-- 开发环境 -->
<springProfile name="dev">
<root level="INFO">
<root level="${LOG_LEVEL_ROOT}">
<appender-ref ref="CONSOLE"/>
</root>
</springProfile>
<!-- 生产环境 -->
<springProfile name="prod">
<root level="INFO">
<root level="${LOG_LEVEL_ROOT}">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="FILE_INFO"/>
<appender-ref ref="FILE_ERROR"/>
@ -113,7 +124,7 @@
</springProfile>
<!-- 默认配置 -->
<root level="INFO">
<root level="${LOG_LEVEL_ROOT}">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="FILE_INFO"/>
<appender-ref ref="FILE_ERROR"/>

View File

@ -40,12 +40,6 @@ mybatis-plus:
logic-delete-value: 1
logic-not-delete-value: 0
logging:
level:
com.fundplatform.exp: DEBUG
pattern:
console: "${LOG_PATTERN:%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n}"
# 多租户路由配置
tenant:
routing:

View File

@ -1,14 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<!-- 定义日志文件路径 -->
<property name="LOG_PATH" value="./logs"/>
<property name="APP_NAME" value="fund-exp"/>
<!-- 从环境变量/系统属性读取配置 -->
<springProperty scope="context" name="APP_NAME" source="spring.application.name" defaultValue="fund-sys"/>
<springProperty scope="context" name="LOG_PATH" source="logging.file.path" defaultValue="/datacfs/applogs"/>
<springProperty scope="context" name="LOG_LEVEL_ROOT" source="logging.level.root" defaultValue="INFO"/>
<springProperty scope="context" name="LOG_LEVEL_APP" source="logging.level.app" defaultValue="DEBUG"/>
<springProperty scope="context" name="LOG_PATTERN" source="logging.pattern.console"
defaultValue="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{traceId:-}][%X{spanId:-}] %-5level %logger{50} - %msg%n"/>
<!-- 控制台输出 -->
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{traceId:-}][%X{spanId:-}] %-5level %logger{50} - %msg%n</pattern>
<pattern>${LOG_PATTERN}</pattern>
<charset>UTF-8</charset>
</encoder>
</appender>
@ -17,7 +21,7 @@
<appender name="FILE_INFO" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_PATH}/${APP_NAME}/info.log</file>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{traceId:-}][%X{spanId:-}] %-5level %logger{50} - %msg%n</pattern>
<pattern>${LOG_PATTERN}</pattern>
<charset>UTF-8</charset>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
@ -38,7 +42,7 @@
<appender name="FILE_ERROR" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_PATH}/${APP_NAME}/error.log</file>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{traceId:-}][%X{spanId:-}] %-5level %logger{50} - %msg%n</pattern>
<pattern>${LOG_PATTERN}</pattern>
<charset>UTF-8</charset>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
@ -95,16 +99,23 @@
<appender-ref ref="FILE_AOP"/>
</logger>
<!-- 应用包日志级别控制 -->
<logger name="com.fundplatform" level="${LOG_LEVEL_APP}" additivity="false">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="FILE_INFO"/>
<appender-ref ref="FILE_ERROR"/>
</logger>
<!-- 开发环境 -->
<springProfile name="dev">
<root level="INFO">
<root level="${LOG_LEVEL_ROOT}">
<appender-ref ref="CONSOLE"/>
</root>
</springProfile>
<!-- 生产环境 -->
<springProfile name="prod">
<root level="INFO">
<root level="${LOG_LEVEL_ROOT}">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="FILE_INFO"/>
<appender-ref ref="FILE_ERROR"/>
@ -113,7 +124,7 @@
</springProfile>
<!-- 默认配置 -->
<root level="INFO">
<root level="${LOG_LEVEL_ROOT}">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="FILE_INFO"/>
<appender-ref ref="FILE_ERROR"/>

View File

@ -42,12 +42,6 @@ file:
path: ${FILE_STORAGE_PATH:./uploads}
max-size: ${FILE_STORAGE_MAX_BYTES:52428800}
logging:
level:
com.fundplatform.file: DEBUG
pattern:
console: "${LOG_PATTERN:%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n}"
# 共享服务,禁用租户路由
tenant:
routing:

View File

@ -1,14 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<!-- 定义日志文件路径 -->
<property name="LOG_PATH" value="./logs"/>
<property name="APP_NAME" value="fund-file"/>
<!-- 从环境变量/系统属性读取配置 -->
<springProperty scope="context" name="APP_NAME" source="spring.application.name" defaultValue="fund-sys"/>
<springProperty scope="context" name="LOG_PATH" source="logging.file.path" defaultValue="/datacfs/applogs"/>
<springProperty scope="context" name="LOG_LEVEL_ROOT" source="logging.level.root" defaultValue="INFO"/>
<springProperty scope="context" name="LOG_LEVEL_APP" source="logging.level.app" defaultValue="DEBUG"/>
<springProperty scope="context" name="LOG_PATTERN" source="logging.pattern.console"
defaultValue="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{traceId:-}][%X{spanId:-}] %-5level %logger{50} - %msg%n"/>
<!-- 控制台输出 -->
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{traceId:-}][%X{spanId:-}] %-5level %logger{50} - %msg%n</pattern>
<pattern>${LOG_PATTERN}</pattern>
<charset>UTF-8</charset>
</encoder>
</appender>
@ -17,7 +21,7 @@
<appender name="FILE_INFO" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_PATH}/${APP_NAME}/info.log</file>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{traceId:-}][%X{spanId:-}] %-5level %logger{50} - %msg%n</pattern>
<pattern>${LOG_PATTERN}</pattern>
<charset>UTF-8</charset>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
@ -38,7 +42,7 @@
<appender name="FILE_ERROR" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_PATH}/${APP_NAME}/error.log</file>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{traceId:-}][%X{spanId:-}] %-5level %logger{50} - %msg%n</pattern>
<pattern>${LOG_PATTERN}</pattern>
<charset>UTF-8</charset>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
@ -95,16 +99,23 @@
<appender-ref ref="FILE_AOP"/>
</logger>
<!-- 应用包日志级别控制 -->
<logger name="com.fundplatform" level="${LOG_LEVEL_APP}" additivity="false">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="FILE_INFO"/>
<appender-ref ref="FILE_ERROR"/>
</logger>
<!-- 开发环境 -->
<springProfile name="dev">
<root level="INFO">
<root level="${LOG_LEVEL_ROOT}">
<appender-ref ref="CONSOLE"/>
</root>
</springProfile>
<!-- 生产环境 -->
<springProfile name="prod">
<root level="INFO">
<root level="${LOG_LEVEL_ROOT}">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="FILE_INFO"/>
<appender-ref ref="FILE_ERROR"/>
@ -113,7 +124,7 @@
</springProfile>
<!-- 默认配置 -->
<root level="INFO">
<root level="${LOG_LEVEL_ROOT}">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="FILE_INFO"/>
<appender-ref ref="FILE_ERROR"/>

View File

@ -123,11 +123,6 @@ spring:
filters:
- StripPrefix=1
logging:
level:
org.springframework.cloud.gateway: DEBUG
com.fundplatform.common.loadbalancer: DEBUG
# 多租户路由配置
tenant:
routing:

View File

@ -1,14 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<!-- 定义日志文件路径 -->
<property name="LOG_PATH" value="./logs"/>
<property name="APP_NAME" value="fund-gateway"/>
<!-- 从环境变量/系统属性读取配置 -->
<springProperty scope="context" name="APP_NAME" source="spring.application.name" defaultValue="fund-sys"/>
<springProperty scope="context" name="LOG_PATH" source="logging.file.path" defaultValue="/datacfs/applogs"/>
<springProperty scope="context" name="LOG_LEVEL_ROOT" source="logging.level.root" defaultValue="INFO"/>
<springProperty scope="context" name="LOG_LEVEL_APP" source="logging.level.app" defaultValue="DEBUG"/>
<springProperty scope="context" name="LOG_PATTERN" source="logging.pattern.console"
defaultValue="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{traceId:-}][%X{spanId:-}] %-5level %logger{50} - %msg%n"/>
<!-- 控制台输出 -->
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{traceId:-}][%X{spanId:-}] %-5level %logger{50} - %msg%n</pattern>
<pattern>${LOG_PATTERN}</pattern>
<charset>UTF-8</charset>
</encoder>
</appender>
@ -17,7 +21,7 @@
<appender name="FILE_INFO" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_PATH}/${APP_NAME}/info.log</file>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{traceId:-}][%X{spanId:-}] %-5level %logger{50} - %msg%n</pattern>
<pattern>${LOG_PATTERN}</pattern>
<charset>UTF-8</charset>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
@ -38,7 +42,7 @@
<appender name="FILE_ERROR" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_PATH}/${APP_NAME}/error.log</file>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{traceId:-}][%X{spanId:-}] %-5level %logger{50} - %msg%n</pattern>
<pattern>${LOG_PATTERN}</pattern>
<charset>UTF-8</charset>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
@ -74,7 +78,7 @@
</rollingPolicy>
</appender>
<!-- API请求日志文件 -->
<!-- API请求日志文件(AOP) -->
<appender name="FILE_AOP" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_PATH}/${APP_NAME}/aop.log</file>
<encoder>
@ -95,16 +99,23 @@
<appender-ref ref="FILE_AOP"/>
</logger>
<!-- 应用包日志级别控制 -->
<logger name="com.fundplatform" level="${LOG_LEVEL_APP}" additivity="false">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="FILE_INFO"/>
<appender-ref ref="FILE_ERROR"/>
</logger>
<!-- 开发环境 -->
<springProfile name="dev">
<root level="INFO">
<root level="${LOG_LEVEL_ROOT}">
<appender-ref ref="CONSOLE"/>
</root>
</springProfile>
<!-- 生产环境 -->
<springProfile name="prod">
<root level="INFO">
<root level="${LOG_LEVEL_ROOT}">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="FILE_INFO"/>
<appender-ref ref="FILE_ERROR"/>
@ -113,7 +124,7 @@
</springProfile>
<!-- 默认配置 -->
<root level="INFO">
<root level="${LOG_LEVEL_ROOT}">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="FILE_INFO"/>
<appender-ref ref="FILE_ERROR"/>

View File

@ -40,12 +40,6 @@ mybatis-plus:
logic-delete-value: 1
logic-not-delete-value: 0
logging:
level:
com.fundplatform.proj: DEBUG
pattern:
console: "${LOG_PATTERN:%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n}"
# 多租户路由配置
tenant:
routing:

View File

@ -1,14 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<!-- 定义日志文件路径 -->
<property name="LOG_PATH" value="./logs"/>
<property name="APP_NAME" value="fund-proj"/>
<!-- 从环境变量/系统属性读取配置 -->
<springProperty scope="context" name="APP_NAME" source="spring.application.name" defaultValue="fund-sys"/>
<springProperty scope="context" name="LOG_PATH" source="logging.file.path" defaultValue="/datacfs/applogs"/>
<springProperty scope="context" name="LOG_LEVEL_ROOT" source="logging.level.root" defaultValue="INFO"/>
<springProperty scope="context" name="LOG_LEVEL_APP" source="logging.level.app" defaultValue="DEBUG"/>
<springProperty scope="context" name="LOG_PATTERN" source="logging.pattern.console"
defaultValue="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{traceId:-}][%X{spanId:-}] %-5level %logger{50} - %msg%n"/>
<!-- 控制台输出 -->
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{traceId:-}][%X{spanId:-}] %-5level %logger{50} - %msg%n</pattern>
<pattern>${LOG_PATTERN}</pattern>
<charset>UTF-8</charset>
</encoder>
</appender>
@ -17,7 +21,7 @@
<appender name="FILE_INFO" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_PATH}/${APP_NAME}/info.log</file>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{traceId:-}][%X{spanId:-}] %-5level %logger{50} - %msg%n</pattern>
<pattern>${LOG_PATTERN}</pattern>
<charset>UTF-8</charset>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
@ -38,7 +42,7 @@
<appender name="FILE_ERROR" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_PATH}/${APP_NAME}/error.log</file>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{traceId:-}][%X{spanId:-}] %-5level %logger{50} - %msg%n</pattern>
<pattern>${LOG_PATTERN}</pattern>
<charset>UTF-8</charset>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
@ -95,16 +99,23 @@
<appender-ref ref="FILE_AOP"/>
</logger>
<!-- 应用包日志级别控制 -->
<logger name="com.fundplatform" level="${LOG_LEVEL_APP}" additivity="false">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="FILE_INFO"/>
<appender-ref ref="FILE_ERROR"/>
</logger>
<!-- 开发环境 -->
<springProfile name="dev">
<root level="INFO">
<root level="${LOG_LEVEL_ROOT}">
<appender-ref ref="CONSOLE"/>
</root>
</springProfile>
<!-- 生产环境 -->
<springProfile name="prod">
<root level="INFO">
<root level="${LOG_LEVEL_ROOT}">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="FILE_INFO"/>
<appender-ref ref="FILE_ERROR"/>
@ -113,7 +124,7 @@
</springProfile>
<!-- 默认配置 -->
<root level="INFO">
<root level="${LOG_LEVEL_ROOT}">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="FILE_INFO"/>
<appender-ref ref="FILE_ERROR"/>

View File

@ -40,12 +40,6 @@ mybatis-plus:
logic-delete-value: 1
logic-not-delete-value: 0
logging:
level:
com.fundplatform.receipt: DEBUG
pattern:
console: "${LOG_PATTERN:%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n}"
# 多租户路由配置
tenant:
routing:

View File

@ -1,14 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<!-- 定义日志文件路径 -->
<property name="LOG_PATH" value="./logs"/>
<property name="APP_NAME" value="fund-receipt"/>
<!-- 从环境变量/系统属性读取配置 -->
<springProperty scope="context" name="APP_NAME" source="spring.application.name" defaultValue="fund-sys"/>
<springProperty scope="context" name="LOG_PATH" source="logging.file.path" defaultValue="/datacfs/applogs"/>
<springProperty scope="context" name="LOG_LEVEL_ROOT" source="logging.level.root" defaultValue="INFO"/>
<springProperty scope="context" name="LOG_LEVEL_APP" source="logging.level.app" defaultValue="DEBUG"/>
<springProperty scope="context" name="LOG_PATTERN" source="logging.pattern.console"
defaultValue="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{traceId:-}][%X{spanId:-}] %-5level %logger{50} - %msg%n"/>
<!-- 控制台输出 -->
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{traceId:-}][%X{spanId:-}] %-5level %logger{50} - %msg%n</pattern>
<pattern>${LOG_PATTERN}</pattern>
<charset>UTF-8</charset>
</encoder>
</appender>
@ -17,7 +21,7 @@
<appender name="FILE_INFO" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_PATH}/${APP_NAME}/info.log</file>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{traceId:-}][%X{spanId:-}] %-5level %logger{50} - %msg%n</pattern>
<pattern>${LOG_PATTERN}</pattern>
<charset>UTF-8</charset>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
@ -38,7 +42,7 @@
<appender name="FILE_ERROR" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_PATH}/${APP_NAME}/error.log</file>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{traceId:-}][%X{spanId:-}] %-5level %logger{50} - %msg%n</pattern>
<pattern>${LOG_PATTERN}</pattern>
<charset>UTF-8</charset>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
@ -95,16 +99,23 @@
<appender-ref ref="FILE_AOP"/>
</logger>
<!-- 应用包日志级别控制 -->
<logger name="com.fundplatform" level="${LOG_LEVEL_APP}" additivity="false">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="FILE_INFO"/>
<appender-ref ref="FILE_ERROR"/>
</logger>
<!-- 开发环境 -->
<springProfile name="dev">
<root level="INFO">
<root level="${LOG_LEVEL_ROOT}">
<appender-ref ref="CONSOLE"/>
</root>
</springProfile>
<!-- 生产环境 -->
<springProfile name="prod">
<root level="INFO">
<root level="${LOG_LEVEL_ROOT}">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="FILE_INFO"/>
<appender-ref ref="FILE_ERROR"/>
@ -113,7 +124,7 @@
</springProfile>
<!-- 默认配置 -->
<root level="INFO">
<root level="${LOG_LEVEL_ROOT}">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="FILE_INFO"/>
<appender-ref ref="FILE_ERROR"/>

View File

@ -21,12 +21,6 @@ spring:
password: ${DB_PASSWORD:zjf@123456}
driver-class-name: com.mysql.cj.jdbc.Driver
logging:
level:
com.fundplatform.report: DEBUG
pattern:
console: "${LOG_PATTERN:%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n}"
# 共享服务,禁用租户路由
tenant:
routing:

View File

@ -1,14 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<!-- 定义日志文件路径 -->
<property name="LOG_PATH" value="./logs"/>
<property name="APP_NAME" value="fund-report"/>
<!-- 从环境变量/系统属性读取配置 -->
<springProperty scope="context" name="APP_NAME" source="spring.application.name" defaultValue="fund-sys"/>
<springProperty scope="context" name="LOG_PATH" source="logging.file.path" defaultValue="/datacfs/applogs"/>
<springProperty scope="context" name="LOG_LEVEL_ROOT" source="logging.level.root" defaultValue="INFO"/>
<springProperty scope="context" name="LOG_LEVEL_APP" source="logging.level.app" defaultValue="DEBUG"/>
<springProperty scope="context" name="LOG_PATTERN" source="logging.pattern.console"
defaultValue="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{traceId:-}][%X{spanId:-}] %-5level %logger{50} - %msg%n"/>
<!-- 控制台输出 -->
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{traceId:-}][%X{spanId:-}] %-5level %logger{50} - %msg%n</pattern>
<pattern>${LOG_PATTERN}</pattern>
<charset>UTF-8</charset>
</encoder>
</appender>
@ -17,7 +21,7 @@
<appender name="FILE_INFO" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_PATH}/${APP_NAME}/info.log</file>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{traceId:-}][%X{spanId:-}] %-5level %logger{50} - %msg%n</pattern>
<pattern>${LOG_PATTERN}</pattern>
<charset>UTF-8</charset>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
@ -38,7 +42,7 @@
<appender name="FILE_ERROR" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_PATH}/${APP_NAME}/error.log</file>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{traceId:-}][%X{spanId:-}] %-5level %logger{50} - %msg%n</pattern>
<pattern>${LOG_PATTERN}</pattern>
<charset>UTF-8</charset>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
@ -95,16 +99,23 @@
<appender-ref ref="FILE_AOP"/>
</logger>
<!-- 应用包日志级别控制 -->
<logger name="com.fundplatform" level="${LOG_LEVEL_APP}" additivity="false">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="FILE_INFO"/>
<appender-ref ref="FILE_ERROR"/>
</logger>
<!-- 开发环境 -->
<springProfile name="dev">
<root level="INFO">
<root level="${LOG_LEVEL_ROOT}">
<appender-ref ref="CONSOLE"/>
</root>
</springProfile>
<!-- 生产环境 -->
<springProfile name="prod">
<root level="INFO">
<root level="${LOG_LEVEL_ROOT}">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="FILE_INFO"/>
<appender-ref ref="FILE_ERROR"/>
@ -113,7 +124,7 @@
</springProfile>
<!-- 默认配置 -->
<root level="INFO">
<root level="${LOG_LEVEL_ROOT}">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="FILE_INFO"/>
<appender-ref ref="FILE_ERROR"/>

View File

@ -40,12 +40,6 @@ mybatis-plus:
logic-delete-value: 1
logic-not-delete-value: 0
logging:
level:
com.fundplatform.req: DEBUG
pattern:
console: "${LOG_PATTERN:%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n}"
# 多租户路由配置
tenant:
routing:

View File

@ -1,14 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<!-- 定义日志文件路径 -->
<property name="LOG_PATH" value="./logs"/>
<property name="APP_NAME" value="fund-req"/>
<!-- 从环境变量/系统属性读取配置 -->
<springProperty scope="context" name="APP_NAME" source="spring.application.name" defaultValue="fund-sys"/>
<springProperty scope="context" name="LOG_PATH" source="logging.file.path" defaultValue="/datacfs/applogs"/>
<springProperty scope="context" name="LOG_LEVEL_ROOT" source="logging.level.root" defaultValue="INFO"/>
<springProperty scope="context" name="LOG_LEVEL_APP" source="logging.level.app" defaultValue="DEBUG"/>
<springProperty scope="context" name="LOG_PATTERN" source="logging.pattern.console"
defaultValue="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{traceId:-}][%X{spanId:-}] %-5level %logger{50} - %msg%n"/>
<!-- 控制台输出 -->
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{traceId:-}][%X{spanId:-}] %-5level %logger{50} - %msg%n</pattern>
<pattern>${LOG_PATTERN}</pattern>
<charset>UTF-8</charset>
</encoder>
</appender>
@ -17,7 +21,7 @@
<appender name="FILE_INFO" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_PATH}/${APP_NAME}/info.log</file>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{traceId:-}][%X{spanId:-}] %-5level %logger{50} - %msg%n</pattern>
<pattern>${LOG_PATTERN}</pattern>
<charset>UTF-8</charset>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
@ -38,7 +42,7 @@
<appender name="FILE_ERROR" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_PATH}/${APP_NAME}/error.log</file>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{traceId:-}][%X{spanId:-}] %-5level %logger{50} - %msg%n</pattern>
<pattern>${LOG_PATTERN}</pattern>
<charset>UTF-8</charset>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
@ -95,16 +99,23 @@
<appender-ref ref="FILE_AOP"/>
</logger>
<!-- 应用包日志级别控制 -->
<logger name="com.fundplatform" level="${LOG_LEVEL_APP}" additivity="false">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="FILE_INFO"/>
<appender-ref ref="FILE_ERROR"/>
</logger>
<!-- 开发环境 -->
<springProfile name="dev">
<root level="INFO">
<root level="${LOG_LEVEL_ROOT}">
<appender-ref ref="CONSOLE"/>
</root>
</springProfile>
<!-- 生产环境 -->
<springProfile name="prod">
<root level="INFO">
<root level="${LOG_LEVEL_ROOT}">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="FILE_INFO"/>
<appender-ref ref="FILE_ERROR"/>
@ -113,7 +124,7 @@
</springProfile>
<!-- 默认配置 -->
<root level="INFO">
<root level="${LOG_LEVEL_ROOT}">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="FILE_INFO"/>
<appender-ref ref="FILE_ERROR"/>

View File

@ -70,12 +70,6 @@ mybatis-plus:
tenant:
enabled: false # 启用后自动为 SQL 添加 tenant_id 条件
logging:
level:
com.fundplatform.sys: DEBUG
pattern:
console: "${LOG_PATTERN:%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n}"
# 多租户路由配置
tenant:
routing:

View File

@ -1,14 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<!-- 定义日志文件路径 -->
<property name="LOG_PATH" value="./logs"/>
<property name="APP_NAME" value="fund-sys"/>
<!-- 从环境变量/系统属性读取配置 -->
<springProperty scope="context" name="APP_NAME" source="spring.application.name" defaultValue="fund-sys"/>
<springProperty scope="context" name="LOG_PATH" source="logging.file.path" defaultValue="/datacfs/applogs"/>
<springProperty scope="context" name="LOG_LEVEL_ROOT" source="logging.level.root" defaultValue="INFO"/>
<springProperty scope="context" name="LOG_LEVEL_APP" source="logging.level.app" defaultValue="DEBUG"/>
<springProperty scope="context" name="LOG_PATTERN" source="logging.pattern.console"
defaultValue="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{traceId:-}][%X{spanId:-}] %-5level %logger{50} - %msg%n"/>
<!-- 控制台输出 -->
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{traceId:-}][%X{spanId:-}] %-5level %logger{50} - %msg%n</pattern>
<pattern>${LOG_PATTERN}</pattern>
<charset>UTF-8</charset>
</encoder>
</appender>
@ -17,7 +21,7 @@
<appender name="FILE_INFO" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_PATH}/${APP_NAME}/info.log</file>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{traceId:-}][%X{spanId:-}] %-5level %logger{50} - %msg%n</pattern>
<pattern>${LOG_PATTERN}</pattern>
<charset>UTF-8</charset>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
@ -38,7 +42,7 @@
<appender name="FILE_ERROR" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_PATH}/${APP_NAME}/error.log</file>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{traceId:-}][%X{spanId:-}] %-5level %logger{50} - %msg%n</pattern>
<pattern>${LOG_PATTERN}</pattern>
<charset>UTF-8</charset>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
@ -95,16 +99,23 @@
<appender-ref ref="FILE_AOP"/>
</logger>
<!-- 应用包日志级别控制 -->
<logger name="com.fundplatform" level="${LOG_LEVEL_APP}" additivity="false">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="FILE_INFO"/>
<appender-ref ref="FILE_ERROR"/>
</logger>
<!-- 开发环境 -->
<springProfile name="dev">
<root level="INFO">
<root level="${LOG_LEVEL_ROOT}">
<appender-ref ref="CONSOLE"/>
</root>
</springProfile>
<!-- 生产环境 -->
<springProfile name="prod">
<root level="INFO">
<root level="${LOG_LEVEL_ROOT}">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="FILE_INFO"/>
<appender-ref ref="FILE_ERROR"/>
@ -113,7 +124,7 @@
</springProfile>
<!-- 默认配置 -->
<root level="INFO">
<root level="${LOG_LEVEL_ROOT}">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="FILE_INFO"/>
<appender-ref ref="FILE_ERROR"/>

View File

@ -62,9 +62,16 @@ FILE_STORAGE_PATH=./uploads
FILE_STORAGE_MAX_BYTES=52428800
# --------------------------------------------
# 日志配置
# 日志配置由logback-spring.xml统一管理
# --------------------------------------------
LOG_PATTERN=%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n
# 日志文件路径
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
# --------------------------------------------
# 多租户路由配置

View File

@ -24,8 +24,11 @@ fi
# JVM参数可通过环境变量覆盖
JAVA_OPTS="${JAVA_OPTS:--Xms256m -Xmx512m -XX:+UseG1GC -XX:MaxGCPauseMillis=200}"
# 日志参数
# 日志参数从env.properties读取或使用默认值
LOG_OPTS="-Dlogging.file.path=${LOG_HOME} -DAPP_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}"
# 配置文件路径
CONFIG_OPTS="--spring.config.location=${APP_HOME}/conf/application.yml"