From f64cc826bd180dbc3e43d109dce881d5c42d2d01 Mon Sep 17 00:00:00 2001 From: rouchen <3133657697@qq.com> Date: Mon, 20 May 2024 21:44:13 +0800 Subject: [PATCH] =?UTF-8?q?feat=20logstash=E4=BE=9D=E8=B5=96=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- muyu-auth/pom.xml | 6 +- muyu-auth/src/main/resources/bootstrap.yml | 2 + .../src/main/resources/logback-spring.xml | 57 +++++++++++++++++++ 3 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 muyu-auth/src/main/resources/logback-spring.xml diff --git a/muyu-auth/pom.xml b/muyu-auth/pom.xml index c4cba9c..f40dab6 100644 --- a/muyu-auth/pom.xml +++ b/muyu-auth/pom.xml @@ -64,7 +64,11 @@ 8.16.0 - + + net.logstash.logback + logstash-logback-encoder + 6.6 + diff --git a/muyu-auth/src/main/resources/bootstrap.yml b/muyu-auth/src/main/resources/bootstrap.yml index 22f2e31..fd5b23a 100644 --- a/muyu-auth/src/main/resources/bootstrap.yml +++ b/muyu-auth/src/main/resources/bootstrap.yml @@ -10,6 +10,8 @@ spring: profiles: # 环境配置 active: dev +logging: + config: classpath:logback-spring.xml cloud: nacos: discovery: diff --git a/muyu-auth/src/main/resources/logback-spring.xml b/muyu-auth/src/main/resources/logback-spring.xml new file mode 100644 index 0000000..1c6d780 --- /dev/null +++ b/muyu-auth/src/main/resources/logback-spring.xml @@ -0,0 +1,57 @@ + + + + + + + + 115.159.211.196:5044 + + + + + UTC + + + + { + + "app": "${springAppName}_${serverPort}", + + "timestamp": "%d{yyyy-MM-dd HH:mm:ss.SSS}", + + "thread": "%thread", + + "level": "%level", + + "logger_name": "%logger", + + "message": "%msg", + + "stack_trace": "%exception" + } + + + + + + + + + + + + ${LOG_HOME}/${springAppName}-${serverPort}-%d{yyyy-MM-dd}.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + + + \ No newline at end of file