提交 6a9b1a35 authored 作者: 李秋林's avatar 李秋林

gateway服务添加request、response日志

上级 75d009c3
......@@ -91,6 +91,12 @@
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
<build>
......
package com.sfa.gateway.controller;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/config")
@RefreshScope
public class ConfigController {
@Value("${spring.redis.database}")
private String useLocalCache;
@GetMapping("/get")
public String get() {
return useLocalCache;
}
}
\ No newline at end of file
......@@ -130,6 +130,6 @@ public class AuthFilter implements GlobalFilter, Ordered
@Override
public int getOrder()
{
return -200;
return -1;
}
}
\ No newline at end of file
package com.sfa.gateway.pojo;
import lombok.*;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class GatewayLog {
/**请求来源**/
private String origin;
/**访问实例*/
private String targetServer;
/**请求路径*/
private String requestPath;
/**请求方法*/
private String requestMethod;
/**协议 */
private String schema;
/**请求类型 */
private String requestContentType;
/**请求头 */
private String headers;
/**请求体*/
private String requestBody;
/**响应体*/
private String responseData;
/**请求ip*/
private String ip;
/**IP所属城市*/
private String city;
/**开始时间*/
private Long startTime;
/**结束时间*/
private Long endTime;
/**请求时间*/
private String requestTime;
/**响应时间*/
private String responseTime;
/**执行时间*/
private long executeTime;
/**路由配置*/
private String routeConfig;
/**响应状态*/
private String status;
}
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论