From e1d7d9b38f91983158c817c456bca99c0f3675b8 Mon Sep 17 00:00:00 2001 From: Ponfee Date: Fri, 23 Feb 2024 21:59:04 +0800 Subject: [PATCH] replace logback to log4j2 --- disjob-admin/ruoyi-admin/pom.xml | 20 ++++ .../src/main/resources/application.yml | 5 +- .../ruoyi-admin/src/main/resources/log4j2.xml | 59 ++++++++++++ .../src/main/resources/logback.xml | 95 ------------------- disjob-samples/conf-common/log4j2.xml | 24 ++++- 5 files changed, 99 insertions(+), 104 deletions(-) create mode 100644 disjob-admin/ruoyi-admin/src/main/resources/log4j2.xml delete mode 100644 disjob-admin/ruoyi-admin/src/main/resources/logback.xml diff --git a/disjob-admin/ruoyi-admin/pom.xml b/disjob-admin/ruoyi-admin/pom.xml index 11f735b6d..dbbb27029 100644 --- a/disjob-admin/ruoyi-admin/pom.xml +++ b/disjob-admin/ruoyi-admin/pom.xml @@ -31,6 +31,26 @@ org.springframework.boot spring-boot-starter-logging + + + * + * + + + + + + + org.springframework.boot + spring-boot-starter-log4j2 + + + org.slf4j + jcl-over-slf4j + + + org.slf4j + log4j-over-slf4j diff --git a/disjob-admin/ruoyi-admin/src/main/resources/application.yml b/disjob-admin/ruoyi-admin/src/main/resources/application.yml index e37e4f5aa..7993d699f 100644 --- a/disjob-admin/ruoyi-admin/src/main/resources/application.yml +++ b/disjob-admin/ruoyi-admin/src/main/resources/application.yml @@ -26,10 +26,7 @@ server: min-spare: 100 # 日志配置 -logging: - level: - com.ruoyi: debug - org.springframework: warn +logging.config: classpath:log4j2.xml # 用户配置 user: diff --git a/disjob-admin/ruoyi-admin/src/main/resources/log4j2.xml b/disjob-admin/ruoyi-admin/src/main/resources/log4j2.xml new file mode 100644 index 000000000..e1261b7af --- /dev/null +++ b/disjob-admin/ruoyi-admin/src/main/resources/log4j2.xml @@ -0,0 +1,59 @@ + + + + + + + + + ${sys:log.home:-../logs} + ${sys:app.name:-disjob-admin} + %d{yyyy-MM-dd HH:mm:ss.SSS} | %highlight{%-5p} | %t | %c{1} >>>> %msg%n + %d{yyyy-MM-dd HH:mm:ss.SSS} | %-5p | %pid | %t | %c{1} : %msg%n + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/disjob-admin/ruoyi-admin/src/main/resources/logback.xml b/disjob-admin/ruoyi-admin/src/main/resources/logback.xml deleted file mode 100644 index 229efa4fb..000000000 --- a/disjob-admin/ruoyi-admin/src/main/resources/logback.xml +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - - - - - - ${log.pattern} - - - - - - ${log.path}/sys-info.log - - - - ${log.path}/sys-info.%d{yyyy-MM-dd}.log - - 60 - - - ${log.pattern} - - - - INFO - - ACCEPT - - DENY - - - - - ${log.path}/sys-error.log - - - - ${log.path}/sys-error.%d{yyyy-MM-dd}.log - - 60 - - - ${log.pattern} - - - - ERROR - - ACCEPT - - DENY - - - - - - ${log.path}/sys-user.log - - - ${log.path}/sys-user.%d{yyyy-MM-dd}.log - - 60 - - - ${log.pattern} - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/disjob-samples/conf-common/log4j2.xml b/disjob-samples/conf-common/log4j2.xml index 8734adfd1..3621c48a4 100644 --- a/disjob-samples/conf-common/log4j2.xml +++ b/disjob-samples/conf-common/log4j2.xml @@ -6,10 +6,12 @@ + + ${sys:log.home:-../logs} ${sys:app.name:-disjob-samples} %d{yyyy-MM-dd HH:mm:ss.SSS} | %highlight{%-5p} | %t | %c{1} >>>> %msg%n - %d{yyyy-MM-dd HH:mm:ss.SSS} | %-5p | ${sys:PID} | %t | %c{1} : %msg%n + %d{yyyy-MM-dd HH:mm:ss.SSS} | %-5p | %pid | %t | %c{1} : %msg%n @@ -46,11 +48,24 @@ + - - - -