From 0440ecea23bf17079de639b36160108f9ad03715 Mon Sep 17 00:00:00 2001 From: paulGao Date: Thu, 30 Sep 2021 14:48:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96logback=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buyer-api/src/main/resources/application.yml | 13 ++++-- .../src/main/resources/logback-spring.xml | 4 +- buyer-api/src/main/resources/logback.xml | 40 ------------------ common-api/src/main/resources/application.yml | 13 ++++-- .../{logback.xml => logback-spring.xml} | 4 +- config/application.yml | 13 +++--- consumer/src/main/resources/application.yml | 13 ++++-- .../src/main/resources/logback-spring.xml | 4 +- .../src/main/resources/application.yml | 13 ++++-- .../src/main/resources/logback-spring.xml | 6 +-- seller-api/src/main/resources/application.yml | 13 ++++-- .../src/main/resources/logback-spring.xml | 41 +++++++++++++++++++ 12 files changed, 103 insertions(+), 74 deletions(-) rename seller-api/src/main/resources/logback.xml => buyer-api/src/main/resources/logback-spring.xml (89%) delete mode 100644 buyer-api/src/main/resources/logback.xml rename common-api/src/main/resources/{logback.xml => logback-spring.xml} (89%) rename manager-api/src/main/resources/manager.xml => consumer/src/main/resources/logback-spring.xml (89%) rename consumer/src/main/resources/logback.xml => manager-api/src/main/resources/logback-spring.xml (86%) create mode 100644 seller-api/src/main/resources/logback-spring.xml diff --git a/buyer-api/src/main/resources/application.yml b/buyer-api/src/main/resources/application.yml index dd62a1a8..b33e38c7 100644 --- a/buyer-api/src/main/resources/application.yml +++ b/buyer-api/src/main/resources/application.yml @@ -22,6 +22,8 @@ management: exposure: include: '*' spring: + application: + name: buyer-api # 要在其中注册的Spring Boot Admin Server的URL。 boot: admin: @@ -182,6 +184,7 @@ mybatis-plus: # 日志 logging: + config: classpath:logback-spring.xml # 输出级别 level: cn.lili: debug @@ -191,10 +194,12 @@ logging: file: # 指定路径 path: lili-logs - # 最大保存天数 - max-history: 7 - # 每个文件最大大小 - max-size: 5MB + logback: + rollingpolicy: + # 最大保存天数 + max-history: 7 + # 每个文件最大大小 + max-file-size: 5MB #加密参数 jasypt: encryptor: diff --git a/seller-api/src/main/resources/logback.xml b/buyer-api/src/main/resources/logback-spring.xml similarity index 89% rename from seller-api/src/main/resources/logback.xml rename to buyer-api/src/main/resources/logback-spring.xml index ce08fb6f..8e2f8cac 100644 --- a/seller-api/src/main/resources/logback.xml +++ b/buyer-api/src/main/resources/logback-spring.xml @@ -4,9 +4,9 @@ - + - + ${APP_NAME} diff --git a/buyer-api/src/main/resources/logback.xml b/buyer-api/src/main/resources/logback.xml deleted file mode 100644 index 5837ff17..00000000 --- a/buyer-api/src/main/resources/logback.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - ${APP_NAME} - - - - ${LOG_FILE_PATH}/${APP_NAME}-%d{yyyy-MM-dd}.log - 30 - - - ${FILE_LOG_PATTERN} - - - - - - 127.0.0.1:4560 - - - - UTC - - - - {"appName":"${APP_NAME}"} - - - - - - - - \ No newline at end of file diff --git a/common-api/src/main/resources/application.yml b/common-api/src/main/resources/application.yml index 8f456df0..1157b9bf 100644 --- a/common-api/src/main/resources/application.yml +++ b/common-api/src/main/resources/application.yml @@ -22,6 +22,8 @@ management: exposure: include: '*' spring: + application: + name: common-api # 要在其中注册的Spring Boot Admin Server的URL。 boot: admin: @@ -181,6 +183,7 @@ mybatis-plus: # 日志 logging: + config: classpath:logback-spring.xml # 输出级别 level: cn.lili: info @@ -190,10 +193,12 @@ logging: file: # 指定路径 path: lili-logs - # 最大保存天数 - max-history: 7 - # 每个文件最大大小 - max-size: 5MB + logback: + rollingpolicy: + # 最大保存天数 + max-history: 7 + # 每个文件最大大小 + max-file-size: 5MB #加密参数 jasypt: encryptor: diff --git a/common-api/src/main/resources/logback.xml b/common-api/src/main/resources/logback-spring.xml similarity index 89% rename from common-api/src/main/resources/logback.xml rename to common-api/src/main/resources/logback-spring.xml index 46dec7c7..8e2f8cac 100644 --- a/common-api/src/main/resources/logback.xml +++ b/common-api/src/main/resources/logback-spring.xml @@ -4,9 +4,9 @@ - + - + ${APP_NAME} diff --git a/config/application.yml b/config/application.yml index 8c576e32..e3e81029 100644 --- a/config/application.yml +++ b/config/application.yml @@ -182,6 +182,7 @@ mybatis-plus: # 日志 logging: + config: classpath:logback-spring.xml # 输出级别 level: cn.lili: info @@ -190,11 +191,13 @@ logging: # org.springframework.data.mongodb.core: debug file: # 指定路径 - path: lili-logs - # 最大保存天数 - max-history: 7 - # 每个文件最大大小 - max-size: 5MB + path: logs + logback: + rollingpolicy: + # 最大保存天数 + max-history: 7 + # 每个文件最大大小 + max-file-size: 5MB #加密参数 jasypt: encryptor: diff --git a/consumer/src/main/resources/application.yml b/consumer/src/main/resources/application.yml index ed3853a6..1ec5a786 100644 --- a/consumer/src/main/resources/application.yml +++ b/consumer/src/main/resources/application.yml @@ -25,6 +25,8 @@ management: exposure: include: '*' spring: + application: + name: consumer # 要在其中注册的Spring Boot Admin Server的URL。 boot: admin: @@ -184,6 +186,7 @@ mybatis-plus: # 日志 logging: + config: classpath:logback-spring.xml # 输出级别 level: cn.lili: info @@ -193,10 +196,12 @@ logging: file: # 指定路径 path: lili-logs - # 最大保存天数 - max-history: 7 - # 每个文件最大大小 - max-size: 5MB + logback: + rollingpolicy: + # 最大保存天数 + max-history: 7 + # 每个文件最大大小 + max-file-size: 5MB #加密参数 jasypt: encryptor: diff --git a/manager-api/src/main/resources/manager.xml b/consumer/src/main/resources/logback-spring.xml similarity index 89% rename from manager-api/src/main/resources/manager.xml rename to consumer/src/main/resources/logback-spring.xml index 46dec7c7..8e2f8cac 100644 --- a/manager-api/src/main/resources/manager.xml +++ b/consumer/src/main/resources/logback-spring.xml @@ -4,9 +4,9 @@ - + - + ${APP_NAME} diff --git a/manager-api/src/main/resources/application.yml b/manager-api/src/main/resources/application.yml index 6ac2b29c..8db62326 100644 --- a/manager-api/src/main/resources/application.yml +++ b/manager-api/src/main/resources/application.yml @@ -22,6 +22,8 @@ management: exposure: include: '*' spring: + application: + name: manager-api # 要在其中注册的Spring Boot Admin Server的URL。 boot: admin: @@ -166,6 +168,7 @@ mybatis-plus: # 日志 logging: + config: classpath:logback-spring.xml # 输出级别 level: cn.lili: info @@ -175,10 +178,12 @@ logging: file: # 指定路径 path: lili-logs - # 最大保存天数 - max-history: 7 - # 每个文件最大大小 - max-size: 5MB + logback: + rollingpolicy: + # 最大保存天数 + max-history: 7 + # 每个文件最大大小 + max-file-size: 5MB #加密参数 jasypt: encryptor: diff --git a/consumer/src/main/resources/logback.xml b/manager-api/src/main/resources/logback-spring.xml similarity index 86% rename from consumer/src/main/resources/logback.xml rename to manager-api/src/main/resources/logback-spring.xml index 45ee2e13..8e2f8cac 100644 --- a/consumer/src/main/resources/logback.xml +++ b/manager-api/src/main/resources/logback-spring.xml @@ -4,9 +4,9 @@ - + - + ${APP_NAME} @@ -22,7 +22,7 @@ - 192.168.0.116:4560 + 127.0.0.1:4560 diff --git a/seller-api/src/main/resources/application.yml b/seller-api/src/main/resources/application.yml index b4980cde..2eb3eebe 100644 --- a/seller-api/src/main/resources/application.yml +++ b/seller-api/src/main/resources/application.yml @@ -22,6 +22,8 @@ management: exposure: include: '*' spring: + application: + name: seller-api # 要在其中注册的Spring Boot Admin Server的URL。 boot: admin: @@ -164,6 +166,7 @@ mybatis-plus: # 日志 logging: + config: classpath:logback-spring.xml # 输出级别 level: cn.lili: info @@ -173,10 +176,12 @@ logging: file: # 指定路径 path: lili-logs - # 最大保存天数 - max-history: 7 - # 每个文件最大大小 - max-size: 5MB + logback: + rollingpolicy: + # 最大保存天数 + max-history: 7 + # 每个文件最大大小 + max-file-size: 5MB #加密参数 jasypt: encryptor: diff --git a/seller-api/src/main/resources/logback-spring.xml b/seller-api/src/main/resources/logback-spring.xml new file mode 100644 index 00000000..8e2f8cac --- /dev/null +++ b/seller-api/src/main/resources/logback-spring.xml @@ -0,0 +1,41 @@ + + + + + + + + + + ${APP_NAME} + + + + ${LOG_FILE_PATH}/${APP_NAME}-%d{yyyy-MM-dd}.log + 30 + + + ${FILE_LOG_PATTERN} + + + + + + + 127.0.0.1:4560 + + + + UTC + + + + {"appName":"${APP_NAME}"} + + + + + + + + \ No newline at end of file