Browse Source

gateway tranceId改造

dev
wangxianzhang 4 years ago
parent
commit
6c0e5d34aa
  1. 6
      epmet-gateway/src/main/java/com/epmet/filter/EpmetGatewayFilter.java

6
epmet-gateway/src/main/java/com/epmet/filter/EpmetGatewayFilter.java

@ -17,6 +17,7 @@ import com.epmet.utils.ServerHttpRequestUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.MDC;
import org.springframework.cloud.gateway.filter.GatewayFilter;
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
import org.springframework.core.io.buffer.DataBuffer;
@ -94,7 +95,10 @@ public class EpmetGatewayFilter implements GatewayFilter {
// 设置当前线程名
request.mutate().header(AppClientConstant.TRANSACTION_SERIAL_KEY, new String[]{tranSerial});
}
Thread.currentThread().setName(tranSerial);
// Thread.currentThread().setName(tranSerial);
// 设置mdc
MDC.put(AppClientConstant.TRANSACTION_SERIAL_KEY, tranSerial);
//1.打印请求信息
logRequest(request);

Loading…
Cancel
Save