From 16e1a50e08d5a97f269b21688135b15191545a9d Mon Sep 17 00:00:00 2001 From: maxf <1107047387@qq.com> Date: Sat, 27 Oct 2018 16:26:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A5=E5=BF=97=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yexuejc/springboot/base/util/LogUtil.java | 6 +- .../src/main/resources/logback-spring.xml | 127 ++++++++++-------- .../src/test/resources/application.properties | 4 + 3 files changed, 75 insertions(+), 62 deletions(-) diff --git a/yexuejc-springboot-base/src/main/java/com/yexuejc/springboot/base/util/LogUtil.java b/yexuejc-springboot-base/src/main/java/com/yexuejc/springboot/base/util/LogUtil.java index 267c4e0..b9f747b 100644 --- a/yexuejc-springboot-base/src/main/java/com/yexuejc/springboot/base/util/LogUtil.java +++ b/yexuejc-springboot-base/src/main/java/com/yexuejc/springboot/base/util/LogUtil.java @@ -13,15 +13,15 @@ public class LogUtil { /** * 用于记录访问日志,输出到access.log */ - public final static Logger accessLogger = LoggerFactory.getLogger("com.yexuejc.uselaw.access"); + public final static Logger accessLogger = LoggerFactory.getLogger("access"); /** * 用于记录业务日志,输出到biz.log */ - public final static Logger bizLogger = LoggerFactory.getLogger("com.yexuejc.uselaw.biz"); + public final static Logger bizLogger = LoggerFactory.getLogger("biz"); /** * 用于记录程序异常日志,输出到exception.log */ - public final static Logger exceptionLogger = LoggerFactory.getLogger("com.yexuejc.uselaw.exception"); + public final static Logger exceptionLogger = LoggerFactory.getLogger("exception"); /** * 格式化日志消息(将;替换为_) diff --git a/yexuejc-springboot-base/src/main/resources/logback-spring.xml b/yexuejc-springboot-base/src/main/resources/logback-spring.xml index 54e679b..fa08ca0 100644 --- a/yexuejc-springboot-base/src/main/resources/logback-spring.xml +++ b/yexuejc-springboot-base/src/main/resources/logback-spring.xml @@ -1,63 +1,72 @@ - - + + + + + + - - - - ${context.name} - - ${log.path}/access.log - - ${log.path}/access.${roll.file.suffix} - - - - ${log.pattern} - - - - ${log.path}/biz.log - - ${log.path}/biz.${roll.file.suffix} - - - - ${log.pattern} - - - - ${log.path}/exception.log - - ${log.path}/exception.${roll.file.suffix} - - - - ${log.pattern} - - - - - - - - - - - - - - - - ${log.pattern} - - - - - + + + ${context.name} + + ${log.path}/access.log + + ${log.path}/access.${roll.file.suffix} + + + + ${log.pattern} + + + + ${log.path}/biz.log + + ${log.path}/biz.${roll.file.suffix} + + + + ${log.pattern} + + + + ${log.path}/exception.log + + ${log.path}/exception.${roll.file.suffix} + + + + ${log.pattern} + + + + + + + + + + + + + + + + + + + ${log.pattern} + + + + + diff --git a/yexuejc-springboot-base/src/test/resources/application.properties b/yexuejc-springboot-base/src/test/resources/application.properties index 00d3c94..308233e 100644 --- a/yexuejc-springboot-base/src/test/resources/application.properties +++ b/yexuejc-springboot-base/src/test/resources/application.properties @@ -1,5 +1,9 @@ server.port=8888 +spring.application.name=@pom.artifactId@ + +#log logging.level.root=info +logging.path=/logs/yexuejc-springboot-base yexuejc.http.filter.type=0