From 3c458e660c4193246381ea3f0f3ba1cea5c50dd2 Mon Sep 17 00:00:00 2001 From: sodaRyCN <757083350@qq.com> Date: Wed, 30 Aug 2023 16:47:49 +0800 Subject: [PATCH 1/2] log when response is fail and no error --- common/remote/rpc/rpc_client.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/common/remote/rpc/rpc_client.go b/common/remote/rpc/rpc_client.go index d30826af..b1ac3170 100644 --- a/common/remote/rpc/rpc_client.go +++ b/common/remote/rpc/rpc_client.go @@ -505,6 +505,9 @@ func (r *RpcClient) Request(request rpc_request.IRequest, timeoutMills int64) (r currentErr = waitReconnect(timeoutMills, &retryTimes, request, errors.New(response.GetMessage())) continue } + if response != nil && !response.IsSuccess() { + logger.Warnf("%s request received fail response, error code %d, result code %d, message %s", request.GetRequestType(), response.GetErrorCode(), response.GetResultCode(), response.GetMessage()) + } r.lastActiveTimestamp.Store(time.Now()) return response, nil } From e7d05f05a5d7690694f87dccb3d06d7046b9ea28 Mon Sep 17 00:00:00 2001 From: sodaRyCN <757083350@qq.com> Date: Thu, 31 Aug 2023 16:14:49 +0800 Subject: [PATCH 2/2] format log --- common/remote/rpc/rpc_client.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/remote/rpc/rpc_client.go b/common/remote/rpc/rpc_client.go index b1ac3170..06d8b48e 100644 --- a/common/remote/rpc/rpc_client.go +++ b/common/remote/rpc/rpc_client.go @@ -506,7 +506,7 @@ func (r *RpcClient) Request(request rpc_request.IRequest, timeoutMills int64) (r continue } if response != nil && !response.IsSuccess() { - logger.Warnf("%s request received fail response, error code %d, result code %d, message %s", request.GetRequestType(), response.GetErrorCode(), response.GetResultCode(), response.GetMessage()) + logger.Warnf("%s request received fail response, error code: %d, result code: %d, message: [%s]", request.GetRequestType(), response.GetErrorCode(), response.GetResultCode(), response.GetMessage()) } r.lastActiveTimestamp.Store(time.Now()) return response, nil