From 89848cebf357ef659dc5d7ab3236b71cf7f912d9 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 18 Jun 2022 00:37:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A5=E5=BF=97=E6=96=87=E4=BB=B6=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E3=80=82=E6=B3=A8=E6=84=8F=EF=BC=8C=E5=A6=82=E6=9E=9C?= =?UTF-8?q?=20logging.file.name=20=E4=B8=8D=E6=94=BE=E5=9C=A8=20bootstrap.?= =?UTF-8?q?yaml=20=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6=EF=BC=8C=E8=80=8C?= =?UTF-8?q?=E6=98=AF=E6=94=BE=E5=9C=A8=20application.yaml=20=E4=B8=AD?= =?UTF-8?q?=EF=BC=8C=E4=BC=9A=E5=AF=BC=E8=87=B4=E5=87=BA=E7=8E=B0=20LOG=5F?= =?UTF-8?q?FILE=5FIS=5FUNDEFINED=20=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/bootstrap.yaml | 5 ++ .../src/main/resources/logback-spring.xml | 76 +++++++++++++++++++ .../src/main/resources/application-dev.yaml | 8 +- .../src/main/resources/bootstrap-local.yaml | 2 - .../src/main/resources/bootstrap.yaml | 5 ++ .../src/main/resources/application-dev.yaml | 13 +--- .../src/main/resources/application-local.yaml | 4 - .../src/main/resources/bootstrap.yaml | 5 ++ 8 files changed, 93 insertions(+), 25 deletions(-) create mode 100644 yudao-gateway/src/main/resources/logback-spring.xml diff --git a/yudao-gateway/src/main/resources/bootstrap.yaml b/yudao-gateway/src/main/resources/bootstrap.yaml index bdc9b21e..3eed7be6 100644 --- a/yudao-gateway/src/main/resources/bootstrap.yaml +++ b/yudao-gateway/src/main/resources/bootstrap.yaml @@ -7,3 +7,8 @@ spring: server: port: 48080 + +# 日志文件配置。注意,如果 logging.file.name 不放在 bootstrap.yaml 配置文件,而是放在 application.yaml 中,会导致出现 LOG_FILE_IS_UNDEFINED 文件 +logging: + file: + name: ${user.home}/logs/${spring.application.name}.log # 日志文件名,全路径 diff --git a/yudao-gateway/src/main/resources/logback-spring.xml b/yudao-gateway/src/main/resources/logback-spring.xml new file mode 100644 index 00000000..8c85ad49 --- /dev/null +++ b/yudao-gateway/src/main/resources/logback-spring.xml @@ -0,0 +1,76 @@ + + + + + + + + + +       + + + ${PATTERN_DEFAULT} + + + + + + + + + + ${PATTERN_DEFAULT} + + + + ${LOG_FILE} + + + ${LOGBACK_ROLLINGPOLICY_FILE_NAME_PATTERN:-${LOG_FILE}.%d{yyyy-MM-dd}.%i.gz} + + ${LOGBACK_ROLLINGPOLICY_CLEAN_HISTORY_ON_START:-false} + + ${LOGBACK_ROLLINGPOLICY_MAX_FILE_SIZE:-10MB} + + ${LOGBACK_ROLLINGPOLICY_TOTAL_SIZE_CAP:-0} + + ${LOGBACK_ROLLINGPOLICY_MAX_HISTORY:-30} + + + + + + 0 + + 256 + + + + + + + + ${PATTERN_DEFAULT} + + + + + + + + + + + + + + + + + + + + + + diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/application-dev.yaml b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/application-dev.yaml index 2a8fdd2f..a3cf9165 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/application-dev.yaml +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/application-dev.yaml @@ -1,5 +1,4 @@ --- #################### 数据库相关配置 #################### - spring: # 数据源配置项 autoconfigure: @@ -33,7 +32,7 @@ spring: time-between-eviction-runs-millis: 60000 # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位:毫秒 min-evictable-idle-time-millis: 300000 # 配置一个连接在池中最小生存的时间,单位:毫秒 max-evictable-idle-time-millis: 900000 # 配置一个连接在池中最大生存的时间,单位:毫秒 - validation-query: SELECT 1 # 配置检测连接是否有效 + validation-query: SELECT 1 FROM DUAL # 配置检测连接是否有效 test-while-idle: true test-on-borrow: false test-on-return: false @@ -96,11 +95,6 @@ spring: # Spring Boot Admin Server 服务端的相关配置 context-path: /admin # 配置 Spring -# 日志文件配置 -logging: - file: - name: ${user.home}/logs/${spring.application.name}.log # 日志文件名,全路径 - --- #################### 芋道相关配置 #################### # 芋道配置项,设置当前项目所有自定义的配置 diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/bootstrap-local.yaml b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/bootstrap-local.yaml index 66852b52..480f8935 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/bootstrap-local.yaml +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/bootstrap-local.yaml @@ -132,8 +132,6 @@ spring: # 日志文件配置 logging: - file: - name: ${user.home}/logs/${spring.application.name}.log # 日志文件名,全路径 level: # 配置自己写的 MyBatis Mapper 打印日志 cn.iocoder.yudao.module.infra.dal.mysql: debug diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/bootstrap.yaml b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/bootstrap.yaml index 9d6ac69e..a276ad44 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/bootstrap.yaml +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/bootstrap.yaml @@ -7,3 +7,8 @@ spring: server: port: 48082 + +# 日志文件配置。注意,如果 logging.file.name 不放在 bootstrap.yaml 配置文件,而是放在 application.yaml 中,会导致出现 LOG_FILE_IS_UNDEFINED 文件 +logging: + file: + name: ${user.home}/logs/${spring.application.name}.log # 日志文件名,全路径 diff --git a/yudao-module-system/yudao-module-system-biz/src/main/resources/application-dev.yaml b/yudao-module-system/yudao-module-system-biz/src/main/resources/application-dev.yaml index 577c2011..b556d07b 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/resources/application-dev.yaml +++ b/yudao-module-system/yudao-module-system-biz/src/main/resources/application-dev.yaml @@ -1,8 +1,4 @@ -server: - port: 48081 - --- #################### 数据库相关配置 #################### - spring: # 数据源配置项 autoconfigure: @@ -36,7 +32,7 @@ spring: time-between-eviction-runs-millis: 60000 # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位:毫秒 min-evictable-idle-time-millis: 300000 # 配置一个连接在池中最小生存的时间,单位:毫秒 max-evictable-idle-time-millis: 900000 # 配置一个连接在池中最大生存的时间,单位:毫秒 - validation-query: SELECT 1 # 配置检测连接是否有效 + validation-query: SELECT 1 FROM DUAL # 配置检测连接是否有效 test-while-idle: true test-on-borrow: false test-on-return: false @@ -68,8 +64,6 @@ jasypt: --- #################### 定时任务相关配置 #################### ---- #################### 配置中心相关配置 #################### - --- #################### 服务保障相关配置 #################### # Lock4j 配置项 @@ -99,11 +93,6 @@ spring: # Spring Boot Admin Server 服务端的相关配置 context-path: /admin # 配置 Spring -# 日志文件配置 -logging: - file: - name: ${user.home}/logs/${spring.application.name}.log # 日志文件名,全路径 - --- #################### 微信公众号相关配置 #################### wx: # 参见 https://github.com/Wechat-Group/WxJava/blob/develop/spring-boot-starters/wx-java-mp-spring-boot-starter/README.md 文档 mp: diff --git a/yudao-module-system/yudao-module-system-biz/src/main/resources/application-local.yaml b/yudao-module-system/yudao-module-system-biz/src/main/resources/application-local.yaml index 9d696bf9..917e6d73 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/resources/application-local.yaml +++ b/yudao-module-system/yudao-module-system-biz/src/main/resources/application-local.yaml @@ -1,6 +1,5 @@ --- #################### 数据库相关配置 #################### spring: - # 数据源配置项 autoconfigure: exclude: @@ -104,8 +103,6 @@ spring: # 日志文件配置 logging: - file: - name: ${user.home}/logs/${spring.application.name}.log # 日志文件名,全路径 level: # 配置自己写的 MyBatis Mapper 打印日志 cn.iocoder.yudao.module.system.dal.mysql: debug @@ -157,4 +154,3 @@ justauth: type: REDIS prefix: 'social_auth_state:' # 缓存前缀,目前只对 Redis 缓存生效,默认 JUSTAUTH::STATE:: timeout: 24h # 超时时长,目前只对 Redis 缓存生效,默认 3 分钟 - diff --git a/yudao-module-system/yudao-module-system-biz/src/main/resources/bootstrap.yaml b/yudao-module-system/yudao-module-system-biz/src/main/resources/bootstrap.yaml index ffb5a84d..273749c7 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/resources/bootstrap.yaml +++ b/yudao-module-system/yudao-module-system-biz/src/main/resources/bootstrap.yaml @@ -7,3 +7,8 @@ spring: server: port: 48081 + +# 日志文件配置。注意,如果 logging.file.name 不放在 bootstrap.yaml 配置文件,而是放在 application.yaml 中,会导致出现 LOG_FILE_IS_UNDEFINED 文件 +logging: + file: + name: ${user.home}/logs/${spring.application.name}.log # 日志文件名,全路径