日志修改
This commit is contained in:
parent
0b0126dd00
commit
cb56fe6a05
@ -1,5 +1,8 @@
|
||||
package com.zhgd.interceptor;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.zhgd.xmgl.constant.Cts;
|
||||
import com.zhgd.xmgl.util.ThreadLocalUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
@ -15,7 +18,10 @@ public class LogInterceptor implements HandlerInterceptor {
|
||||
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||
if (!StrUtil.endWith(request.getRequestURL(), ".png")) {
|
||||
log.info("请求url:{}--------------------------------", request.getRequestURL());
|
||||
ThreadLocalUtil.addInKey(Cts.TL_IS_NOMAL_INTERFACE, true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -58,4 +58,5 @@ public interface Cts {
|
||||
*/
|
||||
String HK_SYNC_AUTH_SUCCESS_KEY = "hkSyncAuthSuccess:";
|
||||
String TL_HK_SYNC_ID = "tl_hk_sync_id";
|
||||
String TL_IS_NOMAL_INTERFACE = "isNormalInterface";
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.servlet.*;
|
||||
import java.io.IOException;
|
||||
import java.util.Optional;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@ -22,7 +23,9 @@ public class RequestIdFilter implements Filter {
|
||||
try {
|
||||
filterChain.doFilter(servletRequest, servletResponse);
|
||||
} finally {
|
||||
if (Optional.ofNullable(ThreadLocalUtil.getByKey(Cts.TL_IS_NOMAL_INTERFACE, Boolean.class)).orElse(false)) {
|
||||
log.info("接口结束...");
|
||||
}
|
||||
LogMdcUtil.clear();
|
||||
ThreadLocalUtil.remove();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user