Commit 3201f3e7 by 袁伟铭

1.0.0

parent 30e248ca
......@@ -73,13 +73,13 @@ public class ApiController {
form.setApiTokenVo(tokenVo);
}
String errorInfo = "";
String stackTrace = "";
// 调用接口方法
ApiResp resp;
try {
resp = apiService.action(form);
} catch (Exception e) {
errorInfo = ThrowableUtil.getStackTrace(e);
stackTrace = ThrowableUtil.getStackTrace(e);
e.printStackTrace();
// 判断指定异常是否来自或者包含指定异常
if (ExceptionUtil.isFromOrSuppressedThrowable(e, FeignException.Unauthorized.class)) {
......@@ -95,7 +95,7 @@ public class ApiController {
// 如果是500错误, 服务会返回错误的堆栈信息
if (resp.getCode().equals(ApiCodeEnum.SERVER_ERROR.code())) {
errorInfo = resp.getMsg();
stackTrace = resp.getMsg();
resp.setMsg(ApiCodeEnum.SERVER_ERROR.msg());
}
......@@ -107,7 +107,7 @@ public class ApiController {
}
String clientIP = ServletUtil.getClientIP(request);
apiService.addLog(form, clientIP, logType, resp.getMsg(), errorInfo, System.currentTimeMillis() - start);
apiService.addLog(form, clientIP, logType, resp.getMsg(), stackTrace, System.currentTimeMillis() - start);
return resp;
}
......
......@@ -78,7 +78,7 @@ public class ApiService {
.ip(ip)
.logType(logType)
.respMsg(respMsg)
.errorInfo(errorInfo)
.stackTrace(errorInfo)
.timeCost(timeCost)
.createTime(DateUtil.date().toJdkDate())
.build());
......
......@@ -80,10 +80,10 @@ public class ApiLog {
private String respMsg;
/**
* 错误信息
* 堆栈跟踪
*/
@ApiModelProperty("错误信息")
private String errorInfo;
@ApiModelProperty("堆栈跟踪")
private String stackTrace;
/**
* 耗时-毫秒
......
......@@ -60,7 +60,7 @@ CREATE TABLE `t_api_log` (
`ip` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT '' COMMENT 'IP',
`log_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT '' COMMENT '日志类型',
`resp_msg` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT '' COMMENT '响应信息',
`error_info` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL COMMENT '错误信息',
`stack_trace` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL COMMENT '堆栈跟踪',
`time_cost` bigint(20) NULL DEFAULT 0 COMMENT '耗时-毫秒',
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
PRIMARY KEY (`id`) USING BTREE
......
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