From 6748ff07967ce878227dfdf1b3b0f22ff211e50f Mon Sep 17 00:00:00 2001 From: ziin Date: Tue, 10 Mar 2026 17:21:24 +0800 Subject: [PATCH] =?UTF-8?q?chore(config):=20=E9=87=8D=E6=9E=84=E7=94=9F?= =?UTF-8?q?=E4=BA=A7=E9=85=8D=E7=BD=AE=E5=B9=B6=E5=BC=95=E5=85=A5=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E6=A1=86=E6=9E=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 精简 application-prod.yml,移除冗余日志格式与滚动策略配置 - 新增 logback-spring.xml,统一日志输出路径与格式 - .gitignore 追加 /logs/ 目录,避免日志文件入库 --- .gitignore | 1 + src/main/resources/application-prod.yml | 13 +------- src/main/resources/logback-spring.xml | 41 +++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 12 deletions(-) create mode 100644 src/main/resources/logback-spring.xml diff --git a/.gitignore b/.gitignore index 3ed6af4..47f4c10 100644 --- a/.gitignore +++ b/.gitignore @@ -50,3 +50,4 @@ build/ /docs/websocket-api.md /src/main/resources/static/ws-test.html /.omc/ +/logs/ diff --git a/src/main/resources/application-prod.yml b/src/main/resources/application-prod.yml index 1085819..7016d97 100644 --- a/src/main/resources/application-prod.yml +++ b/src/main/resources/application-prod.yml @@ -21,20 +21,9 @@ logging: org.springframework: WARN # MyBatis 日志 org.mybatis: WARN - pattern: - # 控制台日志输出格式 - console: "%d{yyyy-MM-dd HH:mm:ss.SSS} | %clr(%-5level){highlight} %clr(${PID:- }){magenta} | %clr(%-15thread){yellow} %clr(%-50logger{50}){cyan} | %msg%n" - # 文件日志输出格式(不带颜色) - file: "%d{yyyy-MM-dd HH:mm:ss.SSS} | %-5level ${PID:- } | %-15thread %-50logger{50} | %msg%n" file: # 日志文件存放路径 name: logs/keyborad-backend.log - # 日志文件滚动策略 - # 单个日志文件最大大小 - logback: - rollingpolicy: - max-file-size: 10MB - max-history: 30 # 用户配置 user: @@ -121,4 +110,4 @@ dromara: end-point: https://b632a61caa85401f63c9b32eef3a74c8.r2.cloudflarestorage.com/keyboardtest # 端点 bucket-name: keyboardtest #桶名称 domain: https://cdn.loveamorkey.com/ # 访问域名,注意末尾的'/',例如:https://abcd.s3.ap-east-1.amazonaws.com/ - base-path: tts/ # 基础路径 \ No newline at end of file + base-path: tts/ # 基础路径 diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml new file mode 100644 index 0000000..0c1dd1c --- /dev/null +++ b/src/main/resources/logback-spring.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + ${CONSOLE_PATTERN} + UTF-8 + + + + + ${LOG_FILE} + + ${FILE_PATTERN} + UTF-8 + + + ${ROLLING_FILE_PATTERN} + 10MB + 30 + + + + + + + +