mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-11-02 12:38:22 +08:00
为接口请求增加日志输出
This commit is contained in:
@ -538,7 +538,9 @@ public class WxCpServiceImpl implements WxCpService {
|
|||||||
int retryTimes = 0;
|
int retryTimes = 0;
|
||||||
do {
|
do {
|
||||||
try {
|
try {
|
||||||
return executeInternal(executor, uri, data);
|
T result = this.executeInternal(executor, uri, data);
|
||||||
|
this.log.debug("\n[URL]: {}\n[PARAMS]: {}\n[RESPONSE]: {}",uri, data, result);
|
||||||
|
return result;
|
||||||
} catch (WxErrorException e) {
|
} catch (WxErrorException e) {
|
||||||
if (retryTimes + 1 > this.maxRetryTimes) {
|
if (retryTimes + 1 > this.maxRetryTimes) {
|
||||||
this.log.warn("重试达到最大次数【{}】", this.maxRetryTimes);
|
this.log.warn("重试达到最大次数【{}】", this.maxRetryTimes);
|
||||||
@ -578,8 +580,7 @@ public class WxCpServiceImpl implements WxCpService {
|
|||||||
uriWithAccessToken += uri.indexOf('?') == -1 ? "?access_token=" + accessToken : "&access_token=" + accessToken;
|
uriWithAccessToken += uri.indexOf('?') == -1 ? "?access_token=" + accessToken : "&access_token=" + accessToken;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return executor.execute(getHttpclient(), this.httpProxy,
|
return executor.execute(getHttpclient(), this.httpProxy, uriWithAccessToken, data);
|
||||||
uriWithAccessToken, data);
|
|
||||||
} catch (WxErrorException e) {
|
} catch (WxErrorException e) {
|
||||||
WxError error = e.getError();
|
WxError error = e.getError();
|
||||||
/*
|
/*
|
||||||
@ -592,11 +593,14 @@ public class WxCpServiceImpl implements WxCpService {
|
|||||||
this.configStorage.expireAccessToken();
|
this.configStorage.expireAccessToken();
|
||||||
return execute(executor, uri, data);
|
return execute(executor, uri, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (error.getErrorCode() != 0) {
|
if (error.getErrorCode() != 0) {
|
||||||
|
this.log.error("\n[URL]: {}\n[PARAMS]: {}\n[RESPONSE]: {}", uri, data, error);
|
||||||
throw new WxErrorException(error);
|
throw new WxErrorException(error);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
this.log.error("\n[URL]: {}\n[PARAMS]: {}\n[EXCEPTION]: {}", uri, data, e.getMessage());
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user