fix:修复网络请求异常时,api日志记录不完整的bug
This commit is contained in:
@@ -84,6 +84,9 @@ public class TestController {
|
||||
String jsonString = JSON.toJSONString(jsonTest);
|
||||
LogFactory.get().info(jsonString);
|
||||
|
||||
String s = OkHttpUtil.get("http://toolbox.tieshengkeji.com/test/login/23232/3232");
|
||||
LogFactory.get().info(s);
|
||||
|
||||
// ArrayList<String> strings = CollUtil.newArrayList("11111", "22222");
|
||||
// coreLogService.addProcess("fdfd", strings, new ProcessImportConsumer<String>() {
|
||||
// @Override
|
||||
|
||||
@@ -14,7 +14,7 @@ import javax.annotation.Resource;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Component
|
||||
public class LogApiOkHttpInterceptor implements Interceptor {
|
||||
public class OkHttpLogInterceptor implements Interceptor {
|
||||
|
||||
@Resource
|
||||
CoreLogApiMapper coreLogApiMapper;
|
||||
@@ -52,6 +52,9 @@ public class LogApiOkHttpInterceptor implements Interceptor {
|
||||
|
||||
response = new Response.Builder()
|
||||
.request(request)
|
||||
.protocol(Protocol.HTTP_1_1)
|
||||
.code(logApi.getResult())
|
||||
.message(e.getMessage())
|
||||
.body(OkHttpUtil.ofJsonResponse(logApi.getRespBody()))
|
||||
.build();
|
||||
}
|
||||
Reference in New Issue
Block a user