From 9db2671fd3ec8792d7f3ddc255fe65a341781785 Mon Sep 17 00:00:00 2001 From: LamGC Date: Sun, 15 Aug 2021 13:21:23 +0800 Subject: [PATCH] =?UTF-8?q?refactor(logging):=20=E7=A7=BB=E9=99=A4=20log4j?= =?UTF-8?q?=20=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6,=20=E6=94=B9=E7=94=A8?= =?UTF-8?q?=20logback=20=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6,=20=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3=20application=20=E9=85=8D=E7=BD=AE=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E5=80=BC.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 移除未使用的 log4j 配置文件, 沿用 SpringBoot 默认日志实现 logback, 添加对应的日志配置文件, 同时修正 application.yml 的各项配置为默认值, 以防误导用户. --- src/main/resources/application.yml | 10 ++-- src/main/resources/log4j2.xml | 75 ------------------------------ src/main/resources/logback.xml | 47 +++++++++++++++++++ 3 files changed, 51 insertions(+), 81 deletions(-) delete mode 100644 src/main/resources/log4j2.xml create mode 100644 src/main/resources/logback.xml diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 85f4928..17c7f41 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -1,10 +1,8 @@ oracle: identity: - # location: "C:\\Users\\80728\\.oci\\global\\" + pattern: '.+\.oracle\.ini$' + location: "./identity/" script: + location: "./scripts/" ssh: - identityPath: "./ssh.config.json" - -logging: - level: - root: INFO \ No newline at end of file + identityPath: "./config/ssh.config.json" diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml deleted file mode 100644 index 99aa3d5..0000000 --- a/src/main/resources/log4j2.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - ./logs - UTF-8 - [%-d{HH:mm:ss.SSS} %5level][%logger.%method():%-3L][%thread]: %msg%n - [%-d{HH:mm:ss.SSS} %5level][%logger]: %msg%n - ${sys:cgj.logsPath:-logs} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml new file mode 100644 index 0000000..2983bf2 --- /dev/null +++ b/src/main/resources/logback.xml @@ -0,0 +1,47 @@ + + + + System.out + + INFO + ACCEPT + DENY + + + [%d{HH:mm:ss.SSS} %5level][%logger][%thread]: %msg%n + + + + System.err + + WARN + + + [%d{HH:mm:ss.SSS} %5level][%logger][%thread]: %msg%n + + + + + ./logs/latest.log + + TRACE + DENY + ACCEPT + + + [%d{HH:mm:ss.SSS} %5level][%logger][%thread]: %msg%n + + + ./logs/run-%d{yyyy-MM-dd}.log + 30 + + + + + + + + + + +