新增 AOP 切面,修改日志输出整合流水号
This commit is contained in:
parent
99a4f39e7e
commit
eb6d2c647a
@ -163,7 +163,7 @@ version: "3"
|
|||||||
services:
|
services:
|
||||||
elasticsearch:
|
elasticsearch:
|
||||||
image: elasticsearch:8.4.2
|
image: elasticsearch:8.4.2
|
||||||
container_name: elasticsearchsky
|
container_name: elasticsearch
|
||||||
ports:
|
ports:
|
||||||
- "9200:9200"
|
- "9200:9200"
|
||||||
healthcheck:
|
healthcheck:
|
||||||
|
@ -47,8 +47,8 @@
|
|||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.xiaoymin</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>knife4j-spring-boot-starter</artifactId>
|
<artifactId>spring-boot-starter-aop</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<properties>
|
<properties>
|
||||||
|
@ -64,6 +64,10 @@
|
|||||||
<artifactId>velocity-engine-core</artifactId>
|
<artifactId>velocity-engine-core</artifactId>
|
||||||
<version>2.0</version>
|
<version>2.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.hutool</groupId>
|
||||||
|
<artifactId>hutool-all</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.source>8</maven.compiler.source>
|
<maven.compiler.source>8</maven.compiler.source>
|
||||||
|
@ -0,0 +1,100 @@
|
|||||||
|
package com.yovinchen.xlcs.common.aspect;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.RandomUtil;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.alibaba.fastjson.support.spring.PropertyPreFilters;
|
||||||
|
import org.aspectj.lang.JoinPoint;
|
||||||
|
import org.aspectj.lang.ProceedingJoinPoint;
|
||||||
|
import org.aspectj.lang.Signature;
|
||||||
|
import org.aspectj.lang.annotation.Around;
|
||||||
|
import org.aspectj.lang.annotation.Aspect;
|
||||||
|
import org.aspectj.lang.annotation.Before;
|
||||||
|
import org.aspectj.lang.annotation.Pointcut;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.slf4j.MDC;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.web.context.request.RequestContextHolder;
|
||||||
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import javax.servlet.ServletRequest;
|
||||||
|
import javax.servlet.ServletResponse;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ClassName: LogAspect
|
||||||
|
* Package: com.yovinchen.xlcs.common.aspect
|
||||||
|
*
|
||||||
|
* @author yovinchen
|
||||||
|
* @Create 2024/1/23 10:43
|
||||||
|
*/
|
||||||
|
@Aspect
|
||||||
|
@Component
|
||||||
|
public class LogAspect {
|
||||||
|
private final static Logger LOG = LoggerFactory.getLogger(LogAspect.class);
|
||||||
|
|
||||||
|
public LogAspect() {
|
||||||
|
System.out.println("Common LogAspect");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定义一个切点
|
||||||
|
*/
|
||||||
|
@Pointcut("execution(public * com.yovinchen.xlcs..*Controller.*(..))")
|
||||||
|
public void controllerPointcut() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Before("controllerPointcut()")
|
||||||
|
public void doBefore(JoinPoint joinPoint) {
|
||||||
|
|
||||||
|
MDC.put("LOG_ID", System.currentTimeMillis() + RandomUtil.randomString(3));
|
||||||
|
// 开始打印请求日志
|
||||||
|
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
||||||
|
HttpServletRequest request = attributes.getRequest();
|
||||||
|
Signature signature = joinPoint.getSignature();
|
||||||
|
String name = signature.getName();
|
||||||
|
|
||||||
|
// 打印请求信息
|
||||||
|
LOG.info("------------- 开始 -------------");
|
||||||
|
LOG.info("请求地址: {} {}", request.getRequestURL()
|
||||||
|
.toString(), request.getMethod());
|
||||||
|
LOG.info("类名方法: {}.{}", signature.getDeclaringTypeName(), name);
|
||||||
|
LOG.info("远程地址: {}", request.getRemoteAddr());
|
||||||
|
|
||||||
|
// 打印请求参数
|
||||||
|
Object[] args = joinPoint.getArgs();
|
||||||
|
// LOG.info("请求参数: {}", JSONObject.toJSONString(args));
|
||||||
|
|
||||||
|
// 排除特殊类型的参数,如文件类型
|
||||||
|
Object[] arguments = new Object[args.length];
|
||||||
|
for (int i = 0; i < args.length; i++) {
|
||||||
|
if (args[i] instanceof ServletRequest || args[i] instanceof ServletResponse || args[i] instanceof MultipartFile) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
arguments[i] = args[i];
|
||||||
|
}
|
||||||
|
// 排除字段,敏感字段或太长的字段不显示:身份证、手机号、邮箱、密码等
|
||||||
|
String[] excludeProperties = {};
|
||||||
|
PropertyPreFilters filters = new PropertyPreFilters();
|
||||||
|
PropertyPreFilters.MySimplePropertyPreFilter excludefilter = filters.addFilter();
|
||||||
|
excludefilter.addExcludes(excludeProperties);
|
||||||
|
LOG.info("请求参数: {}", JSONObject.toJSONString(arguments, excludefilter));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Around("controllerPointcut()")
|
||||||
|
public Object doAround(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {
|
||||||
|
long startTime = System.currentTimeMillis();
|
||||||
|
Object result = proceedingJoinPoint.proceed();
|
||||||
|
// 排除字段,敏感字段或太长的字段不显示:身份证、手机号、邮箱、密码等
|
||||||
|
String[] excludeProperties = {};
|
||||||
|
PropertyPreFilters filters = new PropertyPreFilters();
|
||||||
|
PropertyPreFilters.MySimplePropertyPreFilter excludefilter = filters.addFilter();
|
||||||
|
excludefilter.addExcludes(excludeProperties);
|
||||||
|
LOG.info("返回结果: {}", JSONObject.toJSONString(result, excludefilter));
|
||||||
|
LOG.info("------------- 结束 耗时:{} ms -------------", System.currentTimeMillis() - startTime);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -30,7 +30,8 @@
|
|||||||
<mybatis-plus.version>3.4.0</mybatis-plus.version>
|
<mybatis-plus.version>3.4.0</mybatis-plus.version>
|
||||||
<mysql.version>8.0.30</mysql.version>
|
<mysql.version>8.0.30</mysql.version>
|
||||||
<jwt.version>0.7.0</jwt.version>
|
<jwt.version>0.7.0</jwt.version>
|
||||||
<fastjson.version>2.0.0</fastjson.version>
|
<hutool.version>5.8.25</hutool.version>
|
||||||
|
<fastjson.version>1.2.70</fastjson.version>
|
||||||
<httpclient.version>4.5.1</httpclient.version>
|
<httpclient.version>4.5.1</httpclient.version>
|
||||||
<easyexcel.version>3.1.0</easyexcel.version>
|
<easyexcel.version>3.1.0</easyexcel.version>
|
||||||
<aliyun.version>4.1.1</aliyun.version>
|
<aliyun.version>4.1.1</aliyun.version>
|
||||||
@ -69,6 +70,11 @@
|
|||||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||||
<version>${mybatis-plus.version}</version>
|
<version>${mybatis-plus.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.hutool</groupId>
|
||||||
|
<artifactId>hutool-all</artifactId>
|
||||||
|
<version>${hutool.version}</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>mysql</groupId>
|
<groupId>mysql</groupId>
|
||||||
<artifactId>mysql-connector-java</artifactId>
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
|
@ -33,7 +33,10 @@
|
|||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-aop</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
@ -43,6 +43,10 @@
|
|||||||
<groupId>com.alibaba.cloud</groupId>
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-aop</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba.cloud</groupId>
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||||
|
@ -17,12 +17,12 @@
|
|||||||
<property name="LOG_TOTAL_SIZE_CAP" value="100GB"/>
|
<property name="LOG_TOTAL_SIZE_CAP" value="100GB"/>
|
||||||
<!--应用名称-->
|
<!--应用名称-->
|
||||||
<springProperty scope="context" name="APP_NAME" source="spring.application.name" defaultValue="springBoot"/>
|
<springProperty scope="context" name="APP_NAME" source="spring.application.name" defaultValue="springBoot"/>
|
||||||
<!-- 常规输出格式:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
|
<!-- 常规输出格式:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符,%-18X{LOG_ID}线程ID -->
|
||||||
<property name="NORMAL_LOG_PATTERN"
|
<property name="NORMAL_LOG_PATTERN"
|
||||||
value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}.%method@%line - %msg%n"/>
|
value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}.%method@%line - %msg%n"/>
|
||||||
<!-- 彩色输出格式:magenta:洋红,boldMagenta:粗红,yan:青色,·#══> -->
|
<!-- 彩色输出格式:magenta:洋红,boldMagenta:粗红,yan:青色,·#══> -->
|
||||||
<property name="CONSOLE_LOG_PATTERN"
|
<property name="CONSOLE_LOG_PATTERN"
|
||||||
value="%boldMagenta([%d{yyyy-MM-dd HH:mm:ss.SSS}]) %red([%thread]) %boldMagenta(%-5level) %blue(%logger{20}.%method@%line) %magenta(·#═>) %cyan(%msg%n)"/>
|
value="%boldMagenta([%d{yyyy-MM-dd HH:mm:ss.SSS}]) %red([%thread]) %boldMagenta(%-5level) %green(%-18X{LOG_ID}) %blue(%logger{20}.%method@%line) %magenta(·#═>) %cyan(%msg%n)"/>
|
||||||
|
|
||||||
<!-- ==========================控制台输出设置========================== -->
|
<!-- ==========================控制台输出设置========================== -->
|
||||||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
@ -45,7 +45,10 @@
|
|||||||
<artifactId>apm-toolkit-trace</artifactId>
|
<artifactId>apm-toolkit-trace</artifactId>
|
||||||
<version>9.1.0</version>
|
<version>9.1.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-aop</artifactId>
|
||||||
|
</dependency>
|
||||||
<!-- skywalking logback插件 -->
|
<!-- skywalking logback插件 -->
|
||||||
<!-- https://mvnrepository.com/artifact/org.apache.skywalking/apm-toolkit-logback-1.x -->
|
<!-- https://mvnrepository.com/artifact/org.apache.skywalking/apm-toolkit-logback-1.x -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -17,12 +17,12 @@
|
|||||||
<property name="LOG_TOTAL_SIZE_CAP" value="100GB"/>
|
<property name="LOG_TOTAL_SIZE_CAP" value="100GB"/>
|
||||||
<!--应用名称-->
|
<!--应用名称-->
|
||||||
<springProperty scope="context" name="APP_NAME" source="spring.application.name" defaultValue="springBoot"/>
|
<springProperty scope="context" name="APP_NAME" source="spring.application.name" defaultValue="springBoot"/>
|
||||||
<!-- 常规输出格式:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
|
<!-- 常规输出格式:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符,%-18X{LOG_ID}线程ID -->
|
||||||
<property name="NORMAL_LOG_PATTERN"
|
<property name="NORMAL_LOG_PATTERN"
|
||||||
value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}.%method@%line - %msg%n"/>
|
value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}.%method@%line - %msg%n"/>
|
||||||
<!-- 彩色输出格式:magenta:洋红,boldMagenta:粗红,yan:青色,·#══> -->
|
<!-- 彩色输出格式:magenta:洋红,boldMagenta:粗红,yan:青色,·#══> -->
|
||||||
<property name="CONSOLE_LOG_PATTERN"
|
<property name="CONSOLE_LOG_PATTERN"
|
||||||
value="%boldMagenta([%d{yyyy-MM-dd HH:mm:ss.SSS}]) %red([%thread]) %boldMagenta(%-5level) %blue(%logger{20}.%method@%line) %magenta(·#═>) %cyan(%msg%n)"/>
|
value="%boldMagenta([%d{yyyy-MM-dd HH:mm:ss.SSS}]) %red([%thread]) %boldMagenta(%-5level) %green(%-18X{LOG_ID}) %blue(%logger{20}.%method@%line) %magenta(·#═>) %cyan(%msg%n)"/>
|
||||||
|
|
||||||
<!-- ==========================控制台输出设置========================== -->
|
<!-- ==========================控制台输出设置========================== -->
|
||||||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
@ -17,12 +17,12 @@
|
|||||||
<property name="LOG_TOTAL_SIZE_CAP" value="100GB"/>
|
<property name="LOG_TOTAL_SIZE_CAP" value="100GB"/>
|
||||||
<!--应用名称-->
|
<!--应用名称-->
|
||||||
<springProperty scope="context" name="APP_NAME" source="spring.application.name" defaultValue="springBoot"/>
|
<springProperty scope="context" name="APP_NAME" source="spring.application.name" defaultValue="springBoot"/>
|
||||||
<!-- 常规输出格式:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
|
<!-- 常规输出格式:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符,%-18X{LOG_ID}线程ID -->
|
||||||
<property name="NORMAL_LOG_PATTERN"
|
<property name="NORMAL_LOG_PATTERN"
|
||||||
value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}.%method@%line - %msg%n"/>
|
value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}.%method@%line - %msg%n"/>
|
||||||
<!-- 彩色输出格式:magenta:洋红,boldMagenta:粗红,yan:青色,·#══> -->
|
<!-- 彩色输出格式:magenta:洋红,boldMagenta:粗红,yan:青色,·#══> -->
|
||||||
<property name="CONSOLE_LOG_PATTERN"
|
<property name="CONSOLE_LOG_PATTERN"
|
||||||
value="%boldMagenta([%d{yyyy-MM-dd HH:mm:ss.SSS}]) %red([%thread]) %boldMagenta(%-5level) %blue(%logger{20}.%method@%line) %magenta(·#═>) %cyan(%msg%n)"/>
|
value="%boldMagenta([%d{yyyy-MM-dd HH:mm:ss.SSS}]) %red([%thread]) %boldMagenta(%-5level) %green(%-18X{LOG_ID}) %blue(%logger{20}.%method@%line) %magenta(·#═>) %cyan(%msg%n)"/>
|
||||||
|
|
||||||
<!-- ==========================控制台输出设置========================== -->
|
<!-- ==========================控制台输出设置========================== -->
|
||||||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
@ -17,12 +17,12 @@
|
|||||||
<property name="LOG_TOTAL_SIZE_CAP" value="100GB"/>
|
<property name="LOG_TOTAL_SIZE_CAP" value="100GB"/>
|
||||||
<!--应用名称-->
|
<!--应用名称-->
|
||||||
<springProperty scope="context" name="APP_NAME" source="spring.application.name" defaultValue="springBoot"/>
|
<springProperty scope="context" name="APP_NAME" source="spring.application.name" defaultValue="springBoot"/>
|
||||||
<!-- 常规输出格式:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
|
<!-- 常规输出格式:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符,%-18X{LOG_ID}线程ID -->
|
||||||
<property name="NORMAL_LOG_PATTERN"
|
<property name="NORMAL_LOG_PATTERN"
|
||||||
value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}.%method@%line - %msg%n"/>
|
value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}.%method@%line - %msg%n"/>
|
||||||
<!-- 彩色输出格式:magenta:洋红,boldMagenta:粗红,yan:青色,·#══> -->
|
<!-- 彩色输出格式:magenta:洋红,boldMagenta:粗红,yan:青色,·#══> -->
|
||||||
<property name="CONSOLE_LOG_PATTERN"
|
<property name="CONSOLE_LOG_PATTERN"
|
||||||
value="%boldMagenta([%d{yyyy-MM-dd HH:mm:ss.SSS}]) %red([%thread]) %boldMagenta(%-5level) %blue(%logger{20}.%method@%line) %magenta(·#═>) %cyan(%msg%n)"/>
|
value="%boldMagenta([%d{yyyy-MM-dd HH:mm:ss.SSS}]) %red([%thread]) %boldMagenta(%-5level) %green(%-18X{LOG_ID}) %blue(%logger{20}.%method@%line) %magenta(·#═>) %cyan(%msg%n)"/>
|
||||||
|
|
||||||
<!-- ==========================控制台输出设置========================== -->
|
<!-- ==========================控制台输出设置========================== -->
|
||||||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
@ -17,12 +17,12 @@
|
|||||||
<property name="LOG_TOTAL_SIZE_CAP" value="100GB"/>
|
<property name="LOG_TOTAL_SIZE_CAP" value="100GB"/>
|
||||||
<!--应用名称-->
|
<!--应用名称-->
|
||||||
<springProperty scope="context" name="APP_NAME" source="spring.application.name" defaultValue="springBoot"/>
|
<springProperty scope="context" name="APP_NAME" source="spring.application.name" defaultValue="springBoot"/>
|
||||||
<!-- 常规输出格式:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
|
<!-- 常规输出格式:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符,%-18X{LOG_ID}线程ID -->
|
||||||
<property name="NORMAL_LOG_PATTERN"
|
<property name="NORMAL_LOG_PATTERN"
|
||||||
value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}.%method@%line - %msg%n"/>
|
value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}.%method@%line - %msg%n"/>
|
||||||
<!-- 彩色输出格式:magenta:洋红,boldMagenta:粗红,yan:青色,·#══> -->
|
<!-- 彩色输出格式:magenta:洋红,boldMagenta:粗红,yan:青色,·#══> -->
|
||||||
<property name="CONSOLE_LOG_PATTERN"
|
<property name="CONSOLE_LOG_PATTERN"
|
||||||
value="%boldMagenta([%d{yyyy-MM-dd HH:mm:ss.SSS}]) %red([%thread]) %boldMagenta(%-5level) %blue(%logger{20}.%method@%line) %magenta(·#═>) %cyan(%msg%n)"/>
|
value="%boldMagenta([%d{yyyy-MM-dd HH:mm:ss.SSS}]) %red([%thread]) %boldMagenta(%-5level) %green(%-18X{LOG_ID}) %blue(%logger{20}.%method@%line) %magenta(·#═>) %cyan(%msg%n)"/>
|
||||||
|
|
||||||
<!-- ==========================控制台输出设置========================== -->
|
<!-- ==========================控制台输出设置========================== -->
|
||||||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
@ -17,12 +17,12 @@
|
|||||||
<property name="LOG_TOTAL_SIZE_CAP" value="100GB"/>
|
<property name="LOG_TOTAL_SIZE_CAP" value="100GB"/>
|
||||||
<!--应用名称-->
|
<!--应用名称-->
|
||||||
<springProperty scope="context" name="APP_NAME" source="spring.application.name" defaultValue="springBoot"/>
|
<springProperty scope="context" name="APP_NAME" source="spring.application.name" defaultValue="springBoot"/>
|
||||||
<!-- 常规输出格式:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
|
<!-- 常规输出格式:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符,%-18X{LOG_ID}线程ID -->
|
||||||
<property name="NORMAL_LOG_PATTERN"
|
<property name="NORMAL_LOG_PATTERN"
|
||||||
value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}.%method@%line - %msg%n"/>
|
value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}.%method@%line - %msg%n"/>
|
||||||
<!-- 彩色输出格式:magenta:洋红,boldMagenta:粗红,yan:青色,·#══> -->
|
<!-- 彩色输出格式:magenta:洋红,boldMagenta:粗红,yan:青色,·#══> -->
|
||||||
<property name="CONSOLE_LOG_PATTERN"
|
<property name="CONSOLE_LOG_PATTERN"
|
||||||
value="%boldMagenta([%d{yyyy-MM-dd HH:mm:ss.SSS}]) %red([%thread]) %boldMagenta(%-5level) %blue(%logger{20}.%method@%line) %magenta(·#═>) %cyan(%msg%n)"/>
|
value="%boldMagenta([%d{yyyy-MM-dd HH:mm:ss.SSS}]) %red([%thread]) %boldMagenta(%-5level) %green(%-18X{LOG_ID}) %blue(%logger{20}.%method@%line) %magenta(·#═>) %cyan(%msg%n)"/>
|
||||||
|
|
||||||
<!-- ==========================控制台输出设置========================== -->
|
<!-- ==========================控制台输出设置========================== -->
|
||||||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
@ -17,12 +17,12 @@
|
|||||||
<property name="LOG_TOTAL_SIZE_CAP" value="100GB"/>
|
<property name="LOG_TOTAL_SIZE_CAP" value="100GB"/>
|
||||||
<!--应用名称-->
|
<!--应用名称-->
|
||||||
<springProperty scope="context" name="APP_NAME" source="spring.application.name" defaultValue="springBoot"/>
|
<springProperty scope="context" name="APP_NAME" source="spring.application.name" defaultValue="springBoot"/>
|
||||||
<!-- 常规输出格式:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
|
<!-- 常规输出格式:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符,%-18X{LOG_ID}线程ID -->
|
||||||
<property name="NORMAL_LOG_PATTERN"
|
<property name="NORMAL_LOG_PATTERN"
|
||||||
value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}.%method@%line - %msg%n"/>
|
value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}.%method@%line - %msg%n"/>
|
||||||
<!-- 彩色输出格式:magenta:洋红,boldMagenta:粗红,yan:青色,·#══> -->
|
<!-- 彩色输出格式:magenta:洋红,boldMagenta:粗红,yan:青色,·#══> -->
|
||||||
<property name="CONSOLE_LOG_PATTERN"
|
<property name="CONSOLE_LOG_PATTERN"
|
||||||
value="%boldMagenta([%d{yyyy-MM-dd HH:mm:ss.SSS}]) %red([%thread]) %boldMagenta(%-5level) %blue(%logger{20}.%method@%line) %magenta(·#═>) %cyan(%msg%n)"/>
|
value="%boldMagenta([%d{yyyy-MM-dd HH:mm:ss.SSS}]) %red([%thread]) %boldMagenta(%-5level) %green(%-18X{LOG_ID}) %blue(%logger{20}.%method@%line) %magenta(·#═>) %cyan(%msg%n)"/>
|
||||||
|
|
||||||
<!-- ==========================控制台输出设置========================== -->
|
<!-- ==========================控制台输出设置========================== -->
|
||||||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
@ -17,12 +17,12 @@
|
|||||||
<property name="LOG_TOTAL_SIZE_CAP" value="100GB"/>
|
<property name="LOG_TOTAL_SIZE_CAP" value="100GB"/>
|
||||||
<!--应用名称-->
|
<!--应用名称-->
|
||||||
<springProperty scope="context" name="APP_NAME" source="spring.application.name" defaultValue="springBoot"/>
|
<springProperty scope="context" name="APP_NAME" source="spring.application.name" defaultValue="springBoot"/>
|
||||||
<!-- 常规输出格式:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
|
<!-- 常规输出格式:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符,%-18X{LOG_ID}线程ID -->
|
||||||
<property name="NORMAL_LOG_PATTERN"
|
<property name="NORMAL_LOG_PATTERN"
|
||||||
value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}.%method@%line - %msg%n"/>
|
value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}.%method@%line - %msg%n"/>
|
||||||
<!-- 彩色输出格式:magenta:洋红,boldMagenta:粗红,yan:青色,·#══> -->
|
<!-- 彩色输出格式:magenta:洋红,boldMagenta:粗红,yan:青色,·#══> -->
|
||||||
<property name="CONSOLE_LOG_PATTERN"
|
<property name="CONSOLE_LOG_PATTERN"
|
||||||
value="%boldMagenta([%d{yyyy-MM-dd HH:mm:ss.SSS}]) %red([%thread]) %boldMagenta(%-5level) %blue(%logger{20}.%method@%line) %magenta(·#═>) %cyan(%msg%n)"/>
|
value="%boldMagenta([%d{yyyy-MM-dd HH:mm:ss.SSS}]) %red([%thread]) %boldMagenta(%-5level) %green(%-18X{LOG_ID}) %blue(%logger{20}.%method@%line) %magenta(·#═>) %cyan(%msg%n)"/>
|
||||||
|
|
||||||
<!-- ==========================控制台输出设置========================== -->
|
<!-- ==========================控制台输出设置========================== -->
|
||||||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
@ -17,12 +17,12 @@
|
|||||||
<property name="LOG_TOTAL_SIZE_CAP" value="100GB"/>
|
<property name="LOG_TOTAL_SIZE_CAP" value="100GB"/>
|
||||||
<!--应用名称-->
|
<!--应用名称-->
|
||||||
<springProperty scope="context" name="APP_NAME" source="spring.application.name" defaultValue="springBoot"/>
|
<springProperty scope="context" name="APP_NAME" source="spring.application.name" defaultValue="springBoot"/>
|
||||||
<!-- 常规输出格式:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
|
<!-- 常规输出格式:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符,%-18X{LOG_ID}线程ID -->
|
||||||
<property name="NORMAL_LOG_PATTERN"
|
<property name="NORMAL_LOG_PATTERN"
|
||||||
value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}.%method@%line - %msg%n"/>
|
value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}.%method@%line - %msg%n"/>
|
||||||
<!-- 彩色输出格式:magenta:洋红,boldMagenta:粗红,yan:青色,·#══> -->
|
<!-- 彩色输出格式:magenta:洋红,boldMagenta:粗红,yan:青色,·#══> -->
|
||||||
<property name="CONSOLE_LOG_PATTERN"
|
<property name="CONSOLE_LOG_PATTERN"
|
||||||
value="%boldMagenta([%d{yyyy-MM-dd HH:mm:ss.SSS}]) %red([%thread]) %boldMagenta(%-5level) %blue(%logger{20}.%method@%line) %magenta(·#═>) %cyan(%msg%n)"/>
|
value="%boldMagenta([%d{yyyy-MM-dd HH:mm:ss.SSS}]) %red([%thread]) %boldMagenta(%-5level) %green(%-18X{LOG_ID}) %blue(%logger{20}.%method@%line) %magenta(·#═>) %cyan(%msg%n)"/>
|
||||||
|
|
||||||
<!-- ==========================控制台输出设置========================== -->
|
<!-- ==========================控制台输出设置========================== -->
|
||||||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
@ -17,12 +17,12 @@
|
|||||||
<property name="LOG_TOTAL_SIZE_CAP" value="100GB"/>
|
<property name="LOG_TOTAL_SIZE_CAP" value="100GB"/>
|
||||||
<!--应用名称-->
|
<!--应用名称-->
|
||||||
<springProperty scope="context" name="APP_NAME" source="spring.application.name" defaultValue="springBoot"/>
|
<springProperty scope="context" name="APP_NAME" source="spring.application.name" defaultValue="springBoot"/>
|
||||||
<!-- 常规输出格式:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
|
<!-- 常规输出格式:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符,%-18X{LOG_ID}线程ID -->
|
||||||
<property name="NORMAL_LOG_PATTERN"
|
<property name="NORMAL_LOG_PATTERN"
|
||||||
value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}.%method@%line - %msg%n"/>
|
value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}.%method@%line - %msg%n"/>
|
||||||
<!-- 彩色输出格式:magenta:洋红,boldMagenta:粗红,yan:青色,·#══> -->
|
<!-- 彩色输出格式:magenta:洋红,boldMagenta:粗红,yan:青色,·#══> -->
|
||||||
<property name="CONSOLE_LOG_PATTERN"
|
<property name="CONSOLE_LOG_PATTERN"
|
||||||
value="%boldMagenta([%d{yyyy-MM-dd HH:mm:ss.SSS}]) %red([%thread]) %boldMagenta(%-5level) %blue(%logger{20}.%method@%line) %magenta(·#═>) %cyan(%msg%n)"/>
|
value="%boldMagenta([%d{yyyy-MM-dd HH:mm:ss.SSS}]) %red([%thread]) %boldMagenta(%-5level) %green(%-18X{LOG_ID}) %blue(%logger{20}.%method@%line) %magenta(·#═>) %cyan(%msg%n)"/>
|
||||||
|
|
||||||
<!-- ==========================控制台输出设置========================== -->
|
<!-- ==========================控制台输出设置========================== -->
|
||||||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
@ -6,23 +6,23 @@
|
|||||||
<configuration>
|
<configuration>
|
||||||
<!-- 引入默认设置 -->
|
<!-- 引入默认设置 -->
|
||||||
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
|
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
|
||||||
|
<!--文件名-->
|
||||||
<!-- 编码格式设置 -->
|
<!-- 编码格式设置 -->
|
||||||
<property name="ENCODING" value="UTF-8"/>
|
<property name="ENCODING" value="UTF-8"/>
|
||||||
<!-- 日志文件的存储地址,由application.yml中的logging.path配置,根路径默认同项目路径 -->
|
<!-- 日志文件的存储地址,由application.yml中的logging.path配置,根路径默认同项目路径 -->
|
||||||
<!-- <property name="LOG_HOME" value="${LOG_PATH:-./logs}"/>-->
|
<!-- <property name="LOG_HOME" value="${LOG_PATH:-./logs}"/>-->
|
||||||
<property name="LOG_HOME" value="/Users/yovinchen/Desktop/project/xlcs/xlcs-parent/data/logs"/>
|
<property name="LOG_HOME" value="/Users/yovinchen/Desktop/project/xlcs/xlcs-parent/data/logs"/>
|
||||||
<property name="LOG_FILE_MAX_SIZE" value="100MB"/>
|
<property name="LOG_FILE_MAX_SIZE" value="100MB"/>
|
||||||
<property name="LOG_FILE_MAX_HISTORY" value="180"/>
|
<property name="LOG_FILE_MAX_HISTORY" value="180"/>
|
||||||
<property name="LOG_TOTAL_SIZE_CAP" value="100GB"/>
|
<property name="LOG_TOTAL_SIZE_CAP" value="100GB"/>
|
||||||
<!--应用名称-->
|
<!--应用名称-->
|
||||||
<springProperty scope="context" name="APP_NAME" source="spring.application.name" defaultValue="springBoot"/>
|
<springProperty scope="context" name="APP_NAME" source="spring.application.name" defaultValue="springBoot"/>
|
||||||
<!-- 常规输出格式:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
|
<!-- 常规输出格式:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符,%-18X{LOG_ID}线程ID -->
|
||||||
<property name="NORMAL_LOG_PATTERN"
|
<property name="NORMAL_LOG_PATTERN"
|
||||||
value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}.%method@%line - %msg%n"/>
|
value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}.%method@%line - %msg%n"/>
|
||||||
<!-- 彩色输出格式:magenta:洋红,boldMagenta:粗红,yan:青色,·#══> -->
|
<!-- 彩色输出格式:magenta:洋红,boldMagenta:粗红,yan:青色,·#══> -->
|
||||||
<property name="CONSOLE_LOG_PATTERN"
|
<property name="CONSOLE_LOG_PATTERN"
|
||||||
value="%boldMagenta([%d{yyyy-MM-dd HH:mm:ss.SSS}]) %red([%thread]) %boldMagenta(%-5level) %blue(%logger{20}.%method@%line) %magenta(·#═>) %cyan(%msg%n)"/>
|
value="%boldMagenta([%d{yyyy-MM-dd HH:mm:ss.SSS}]) %red([%thread]) %boldMagenta(%-5level) %green(%-18X{LOG_ID}) %blue(%logger{20}.%method@%line) %magenta(·#═>) %cyan(%msg%n)"/>
|
||||||
|
|
||||||
<!-- ==========================控制台输出设置========================== -->
|
<!-- ==========================控制台输出设置========================== -->
|
||||||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
@ -36,7 +36,7 @@
|
|||||||
<appender name="DEBUG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
<appender name="DEBUG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
<!--设置文件命名格式-->
|
<!--设置文件命名格式-->
|
||||||
<!-- <FileNamePattern>${LOG_HOME}/${APP_NAME}/debug/${POD_NAME}-%d{yyyy-MM-dd}-%i.log</FileNamePattern>-->
|
<!-- <FileNamePattern>${LOG_HOME}/${APP_NAME}/debug/${POD_NAME}-%d{yyyy-MM-dd}-%i.log</FileNamePattern>-->
|
||||||
<FileNamePattern>${LOG_HOME}/${APP_NAME}/debug/${APP_NAME}-%d{yyyy-MM-dd}-%i.log</FileNamePattern>
|
<FileNamePattern>${LOG_HOME}/${APP_NAME}/debug/${APP_NAME}-%d{yyyy-MM-dd}-%i.log</FileNamePattern>
|
||||||
<!--设置日志文件大小,超过就重新生成文件,默认10M-->
|
<!--设置日志文件大小,超过就重新生成文件,默认10M-->
|
||||||
<maxFileSize>${LOG_FILE_MAX_SIZE}</maxFileSize>
|
<maxFileSize>${LOG_FILE_MAX_SIZE}</maxFileSize>
|
||||||
@ -60,7 +60,7 @@
|
|||||||
<appender name="INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
<appender name="INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
<!--设置文件命名格式-->
|
<!--设置文件命名格式-->
|
||||||
<!-- <FileNamePattern>${LOG_HOME}/${APP_NAME}/info/${POD_NAME}-%d{yyyy-MM-dd}-%i.log</FileNamePattern>-->
|
<!-- <FileNamePattern>${LOG_HOME}/${APP_NAME}/info/${POD_NAME}-%d{yyyy-MM-dd}-%i.log</FileNamePattern>-->
|
||||||
<FileNamePattern>${LOG_HOME}/${APP_NAME}/info/${APP_NAME}-%d{yyyy-MM-dd}-%i.log</FileNamePattern>
|
<FileNamePattern>${LOG_HOME}/${APP_NAME}/info/${APP_NAME}-%d{yyyy-MM-dd}-%i.log</FileNamePattern>
|
||||||
<!--设置日志文件大小,超过就重新生成文件,默认10M-->
|
<!--设置日志文件大小,超过就重新生成文件,默认10M-->
|
||||||
<maxFileSize>${LOG_FILE_MAX_SIZE}</maxFileSize>
|
<maxFileSize>${LOG_FILE_MAX_SIZE}</maxFileSize>
|
||||||
@ -85,7 +85,6 @@
|
|||||||
<appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
<appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
<!--设置文件命名格式-->
|
<!--设置文件命名格式-->
|
||||||
<!-- <FileNamePattern>${LOG_HOME}/${APP_NAME}/error/${POD_NAME}-%d{yyyy-MM-dd}-%i.log</FileNamePattern>-->
|
|
||||||
<FileNamePattern>${LOG_HOME}/${APP_NAME}/error/${APP_NAME}-%d{yyyy-MM-dd}-%i.log</FileNamePattern>
|
<FileNamePattern>${LOG_HOME}/${APP_NAME}/error/${APP_NAME}-%d{yyyy-MM-dd}-%i.log</FileNamePattern>
|
||||||
<!--设置日志文件大小,超过就重新生成文件,默认10M-->
|
<!--设置日志文件大小,超过就重新生成文件,默认10M-->
|
||||||
<maxFileSize>${LOG_FILE_MAX_SIZE}</maxFileSize>
|
<maxFileSize>${LOG_FILE_MAX_SIZE}</maxFileSize>
|
||||||
@ -108,7 +107,7 @@
|
|||||||
<appender name="DRUID_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
<appender name="DRUID_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
<!--设置文件命名格式-->
|
<!--设置文件命名格式-->
|
||||||
<!-- <FileNamePattern>${LOG_HOME}/${APP_NAME}/druid/SlowSql_${POD_NAME}-%d{yyyy-MM-dd}-%i.log</FileNamePattern>-->
|
<!-- <FileNamePattern>${LOG_HOME}/${APP_NAME}/druid/SlowSql_${POD_NAME}-%d{yyyy-MM-dd}-%i.log</FileNamePattern>-->
|
||||||
<FileNamePattern>${LOG_HOME}/${APP_NAME}/druid/SlowSql_${APP_NAME}-%d{yyyy-MM-dd}-%i.log</FileNamePattern>
|
<FileNamePattern>${LOG_HOME}/${APP_NAME}/druid/SlowSql_${APP_NAME}-%d{yyyy-MM-dd}-%i.log</FileNamePattern>
|
||||||
<!--设置日志文件大小,超过就重新生成文件,默认10M-->
|
<!--设置日志文件大小,超过就重新生成文件,默认10M-->
|
||||||
<maxFileSize>${LOG_FILE_MAX_SIZE}</maxFileSize>
|
<maxFileSize>${LOG_FILE_MAX_SIZE}</maxFileSize>
|
||||||
@ -138,28 +137,38 @@
|
|||||||
<appender-ref ref="DRUID_FILE"/>
|
<appender-ref ref="DRUID_FILE"/>
|
||||||
<appender-ref ref="CONSOLE"/>
|
<appender-ref ref="CONSOLE"/>
|
||||||
</logger>
|
</logger>
|
||||||
<appender name="GELF" class="biz.paluch.logging.gelf.logback.GelfLogbackAppender">
|
<!-- <appender name="GELF" class="biz.paluch.logging.gelf.logback.GelfLogbackAppender">-->
|
||||||
<!--GrayLog服务地址-->
|
<!-- <!–GrayLog服务地址–>-->
|
||||||
<host>udp:10.211.55.50</host>
|
<!-- <host>udp:10.211.55.50</host>-->
|
||||||
<!--GrayLog服务端口-->
|
<!-- <!–GrayLog服务端口–>-->
|
||||||
<port>12201</port>
|
<!-- <port>12201</port>-->
|
||||||
<version>1.1</version>
|
<!-- <version>1.1</version>-->
|
||||||
<!--当前服务名称-->
|
<!-- <!–当前服务名称–>-->
|
||||||
<facility>${APP_NAME}</facility>
|
<!-- <facility>${APP_NAME}</facility>-->
|
||||||
<extractStackTrace>true</extractStackTrace>
|
<!-- <extractStackTrace>true</extractStackTrace>-->
|
||||||
<filterStackTrace>true</filterStackTrace>
|
<!-- <filterStackTrace>true</filterStackTrace>-->
|
||||||
<mdcProfiling>true</mdcProfiling>
|
<!-- <mdcProfiling>true</mdcProfiling>-->
|
||||||
<timestampPattern>yyyy-MM-dd HH:mm:ss,SSS</timestampPattern>
|
<!-- <timestampPattern>yyyy-MM-dd HH:mm:ss,SSS</timestampPattern>-->
|
||||||
<maximumMessageSize>8192</maximumMessageSize>
|
<!-- <maximumMessageSize>8192</maximumMessageSize>-->
|
||||||
|
<!-- </appender>-->
|
||||||
|
<property name="APM_PATTERN"
|
||||||
|
value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%X{tid}] [%thread] %-5level %logger{36} -%msg%n"/>
|
||||||
|
<!-- skyWalking日志采集 -->
|
||||||
|
<appender name="APM_LOG" class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.log.GRPCLogClientAppender">
|
||||||
|
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
|
||||||
|
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.mdc.TraceIdMDCPatternLogbackLayout">
|
||||||
|
<Pattern>${APM_PATTERN}</Pattern>
|
||||||
|
</layout>
|
||||||
|
</encoder>
|
||||||
</appender>
|
</appender>
|
||||||
|
|
||||||
<!-- ======开发环境:打印控制台和输出到文件====== -->
|
<!-- ======开发环境:打印控制台和输出到文件====== -->
|
||||||
<springProfile name="dev"><!-- 由application.yml中的spring.profiles.active配置 -->
|
<springProfile name="dev"><!-- 由application.yml中的spring.profiles.active配置 -->
|
||||||
<root level="INFO">
|
<root level="INFO">
|
||||||
<appender-ref ref="CONSOLE"/>
|
<appender-ref ref="CONSOLE"/>
|
||||||
<appender-ref ref="INFO_FILE"/>
|
<appender-ref ref="INFO_FILE"/>
|
||||||
<appender-ref ref="ERROR_FILE"/>
|
<appender-ref ref="ERROR_FILE"/>
|
||||||
<appender-ref ref="GELF"/>
|
<appender-ref ref="APM_LOG"/>
|
||||||
|
<!-- <appender-ref ref="GELF"/>-->
|
||||||
</root>
|
</root>
|
||||||
</springProfile>
|
</springProfile>
|
||||||
|
|
||||||
@ -170,7 +179,8 @@
|
|||||||
<appender-ref ref="DEBUG_FILE"/>
|
<appender-ref ref="DEBUG_FILE"/>
|
||||||
<appender-ref ref="INFO_FILE"/>
|
<appender-ref ref="INFO_FILE"/>
|
||||||
<appender-ref ref="ERROR_FILE"/>
|
<appender-ref ref="ERROR_FILE"/>
|
||||||
<appender-ref ref="GELF"/>
|
<appender-ref ref="APM_LOG"/>
|
||||||
|
<!-- <appender-ref ref="GELF"/>-->
|
||||||
</root>
|
</root>
|
||||||
</springProfile>
|
</springProfile>
|
||||||
|
|
||||||
@ -181,7 +191,8 @@
|
|||||||
<appender-ref ref="DEBUG_FILE"/>
|
<appender-ref ref="DEBUG_FILE"/>
|
||||||
<appender-ref ref="INFO_FILE"/>
|
<appender-ref ref="INFO_FILE"/>
|
||||||
<appender-ref ref="ERROR_FILE"/>
|
<appender-ref ref="ERROR_FILE"/>
|
||||||
<appender-ref ref="GELF"/>
|
<appender-ref ref="APM_LOG"/>
|
||||||
|
<!-- <appender-ref ref="GELF"/>-->
|
||||||
</root>
|
</root>
|
||||||
</springProfile>
|
</springProfile>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
Loading…
Reference in New Issue
Block a user