Commit 7bcc363d by huluobin

战术更新

parent 86ce4857
...@@ -27,7 +27,8 @@ public enum ErrorCode { ...@@ -27,7 +27,8 @@ public enum ErrorCode {
ErrorCode(Integer code, String message) { ErrorCode(Integer code, String message) {
this.code = code;
this.message = message;
} }
public Integer getCode() { public Integer getCode() {
......
package com.gogirl.infrastructure.common.filter; package com.gogirl.infrastructure.common.filter;
import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import org.slf4j.MDC;
import org.springframework.boot.web.servlet.ServletComponentScan; import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -25,12 +26,14 @@ public class RequestLogFilter implements Filter { ...@@ -25,12 +26,14 @@ public class RequestLogFilter implements Filter {
@Override @Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
request.setAttribute("logTraceId", IdWorker.getIdStr()); String traceId = IdWorker.getIdStr();
request.setAttribute("traceId", traceId);
MDC.put("traceId", traceId);
chain.doFilter(request, response); chain.doFilter(request, response);
} }
@Override @Override
public void destroy() { public void destroy() {
MDC.clear();
} }
} }
package com.gogirl.infrastructure.common.config.config; package com.gogirl.infrastructure.common.interceptor;
import com.gogirl.infrastructure.common.interceptor.AuthHandlerInterceptor;
import com.gogirl.infrastructure.common.interceptor.LogHandlerInterceptor;
import com.gogirl.infrastructure.common.interceptor.LoginHandlerInterceptor;
import com.gogirl.infrastructure.common.interceptor.SessionHandlerInterceptor;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
......
...@@ -39,13 +39,11 @@ public class SessionHandlerInterceptor implements HandlerInterceptor { ...@@ -39,13 +39,11 @@ public class SessionHandlerInterceptor implements HandlerInterceptor {
return true; return true;
} }
if (sourceFrom.equals("customer")) { if (sourceFrom.equals("customer")) {
long time = System.currentTimeMillis();
GogirlToken gogirlToken = gogirlTokenService.getByToken(token); GogirlToken gogirlToken = gogirlTokenService.getByToken(token);
if (gogirlToken != null) { if (gogirlToken != null) {
SessionUtils.putCustomerToken(gogirlToken); SessionUtils.putCustomerToken(gogirlToken);
} }
HandlerMethod h = (HandlerMethod) handler; HandlerMethod h = (HandlerMethod) handler;
log.info(h.getMethod() + "消耗时间:" + (System.currentTimeMillis() - time));
} }
if (sourceFrom.equals("technician")) { if (sourceFrom.equals("technician")) {
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds" debug="true"> <configuration scan="true" scanPeriod="60 seconds" debug="true">
<property name="contextName" value="gogirl-member"/> <property name="contextName" value="gogirl"/>
<property name="LOG_HOME" value="log"/> <property name="LOG_HOME" value="log"/>
<property name="LOG_PATTERN"
value="%d{yyyy-MM-dd HH:mm:ss.SSS} %X{reqId} %X{serverIp} %X{serverName} %-5level %logger{100} - %msg%n"/>
<!-- 彩色日志 --> <!-- 彩色日志 -->
<!-- 彩色日志依赖的渲染类 --> <!-- 彩色日志依赖的渲染类 -->
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/> <conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
<conversionRule conversionWord="wex" <conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/>
converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/> <conversionRule conversionWord="wEx" converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/>
<conversionRule conversionWord="wEx"
converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/>
<!-- 彩色日志格式 --> <!-- 彩色日志格式 -->
<property name="CONSOLE_LOG_PATTERN" <property name="CONSOLE_LOG_PATTERN" value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} ${traceId} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
<contextName>${contextName}</contextName> <contextName>${contextName}</contextName>
       
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment