plumelog
This commit is contained in:
@@ -49,7 +49,7 @@
|
||||
<dependency>
|
||||
<groupId>com.plumelog</groupId>
|
||||
<artifactId>plumelog-trace</artifactId>
|
||||
<version>3.5.2</version>
|
||||
<version>3.5.3</version>
|
||||
</dependency>
|
||||
<!--日志管理end-->
|
||||
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package org.nl.config.plumelog;
|
||||
|
||||
import com.plumelog.trace.aspect.AbstractAspect;
|
||||
import org.aspectj.lang.JoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 全局打点 需要自己定义切入点 (demo 如下 ) 当定义全局打点时,手动打点就会失效
|
||||
* @Date: 2023/1/29
|
||||
*/
|
||||
@Aspect
|
||||
@Component
|
||||
public class AspectConfig extends AbstractAspect {
|
||||
@Around("within(org.nl..*))")
|
||||
public Object around(JoinPoint joinPoint) throws Throwable {
|
||||
return aroundExecute(joinPoint);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package org.nl.config.plumelog;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description:
|
||||
* @Date: 2023/1/29
|
||||
*/
|
||||
@Configuration
|
||||
public class InterceptorConfig implements WebMvcConfigurer {
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
// 自定义拦截器,添加拦截路径和排除拦截路径
|
||||
registry.addInterceptor(new PlumelogInterceptor()).addPathPatterns("/**");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package org.nl.config.plumelog;
|
||||
|
||||
import com.plumelog.core.TraceId;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description:
|
||||
* @Date: 2023/1/29
|
||||
*/
|
||||
@Configuration
|
||||
public class PlumelogInterceptor implements HandlerInterceptor {
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||
|
||||
//设置TraceID值,不埋此点链路ID就没有
|
||||
TraceId.logTraceID.set(UUID.randomUUID().toString().replaceAll("-", ""));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -82,6 +82,7 @@ security:
|
||||
- /api/localStorage/pictures
|
||||
# 参数
|
||||
- /api/param/getValueByCode
|
||||
- /plumelog/**
|
||||
# Sa-Token配置
|
||||
sa-token:
|
||||
# token 名称 (同时也是cookie名称)
|
||||
|
||||
Reference in New Issue
Block a user