From 83d360c40a5a6984db24811da07d8afe87abd054 Mon Sep 17 00:00:00 2001 From: cjl Date: Thu, 21 Feb 2019 16:26:41 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E6=97=A5=E5=BF=97=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 24 ++- src/main/resources/application.properties | 4 + src/main/resources/logback-spring.xml | 197 ++++++++++++++++++++++ 3 files changed, 220 insertions(+), 5 deletions(-) create mode 100644 src/main/resources/logback-spring.xml diff --git a/pom.xml b/pom.xml index 7f1e9547..0516e47e 100644 --- a/pom.xml +++ b/pom.xml @@ -60,11 +60,6 @@ spring-boot-starter-test test - - log4j - log4j - 1.2.17 - com.google.code.gson @@ -107,6 +102,25 @@ lombok 1.16.12 + + + ch.qos.logback + logback-classic + 1.2.3 + compile + + + org.apache.logging.log4j + log4j-to-slf4j + 2.10.0 + compile + + + org.slf4j + jul-to-slf4j + 1.7.25 + compile + diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index f3b627ad..5e36727f 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -9,6 +9,10 @@ mybatis.mapper-locations=classpath:./mapper_xml/*.xml #开启sql打印 logging.level.com.jsh.erp.datasource.mappers=DEBUG +#日志 +logging.config=classpath:logback-spring.xml +logging.level.com.didispace=DEBUG + diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml new file mode 100644 index 00000000..97119f5e --- /dev/null +++ b/src/main/resources/logback-spring.xml @@ -0,0 +1,197 @@ + + + + + + + + + + logback + + + + + + + + + + + + + + + + + debug + + + ${CONSOLE_LOG_PATTERN} + + UTF-8 + + + + + + + + + + ${log.path}/log_debug.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + + ${log.path}/debug/log-debug-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + debug + ACCEPT + DENY + + + + + + + ${log.path}/log_info.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + + ${log.path}/info/log-info-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + info + ACCEPT + DENY + + + + + + + ${log.path}/log_warn.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + ${log.path}/warn/log-warn-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + warn + ACCEPT + DENY + + + + + + + + ${log.path}/log_error.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + ${log.path}/error/log-error-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + ERROR + ACCEPT + DENY + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file