Skip to content

Commit

Permalink
[issue #142] log optimization/ fix typo (#143)
Browse files Browse the repository at this point in the history
  • Loading branch information
GuoYL123 committed Feb 26, 2020
1 parent 6b0e321 commit 26e7c9f
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ public Map<String, String> loadFromConfigCenter(String dimensionsInfo, String pr
return Collections.emptyMap();
}
throw new RemoteOperationException(
"read response failed. status=" + response.getStatusCode() + ";message=" + response
.getStatusMessage());
"read response failed. status:" + response.getStatusCode() + "; message:" + response
.getStatusMessage() + "; content:" + response.getContent());

} catch (RemoteServerUnavailableException e) {
configCenterConfig.toggle();
Expand Down Expand Up @@ -178,8 +178,8 @@ public Map<String, String> loadFromKie(ServiceCombConfigProperties serviceCombCo
return result;
} else {
throw new RemoteOperationException(
"read response failed. status=" + response.getStatusCode() + ";mesage=" + response
.getStatusMessage());
"read response failed. status:" + response.getStatusCode() + "; message:" + response
.getStatusMessage() + "; content:" + response.getContent());
}
} catch (Exception e) {
configCenterConfig.toggle();
Expand Down Expand Up @@ -207,7 +207,7 @@ public boolean updateToKie(ServiceCombConfigProperties serviceCombConfigProperti
return true;
} else {
LOGGER.error(
"create keyValue fails, responseStatusCode={}, responseMessage={}, responseContent{}",
"create keyValue fails, responseStatusCode:{}, responseMessage:{}, responseContent:{}",
response.getStatusCode(), response.getStatusMessage(), response.getContent());
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* @Date 2020/1/11
**/
@Component
public class DiscoveryBoostrap {
public class DiscoveryBootstrap {

@Autowired(required = false)
private ServiceCombAutoServiceRegistration registration;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public class ServiceCombClient {

private static final Logger LOGGER = LoggerFactory.getLogger(ServiceCombClient.class);

URLConfig registryConfig = new URLConfig();
private URLConfig registryConfig = new URLConfig();

private AtomicBoolean initSuccess = new AtomicBoolean(true);

Expand Down Expand Up @@ -123,13 +123,11 @@ public MicroserviceInstancesResponse getServiceCenterInstances()
return result;
}
throw new RemoteOperationException(
"read response failed. status=" + response.getStatusCode() + ";message=" + response
.getStatusMessage());
"read response failed. status:" + response.getStatusCode() + "; message:" + response
.getStatusMessage() + "; content:" + response.getContent());
} catch (URISyntaxException e) {
throw new RemoteOperationException("build url failed.", e);
} catch (IOException e) {
handleRemoteOperationException(response, e);
} catch (RemoteServerUnavailableException e) {
} catch (IOException | RemoteServerUnavailableException e) {
handleRemoteOperationException(response, e);
}
return null;
Expand Down Expand Up @@ -161,8 +159,8 @@ public String registerMicroservice(Microservice microservice) throws ServiceComb
}
} else {
throw new RemoteOperationException(
"read response failed. status=" + response.getStatusCode() + ";message=" + response
.getStatusMessage());
"read response failed. status:" + response.getStatusCode() + "; message:" + response
.getStatusMessage() + "; content:" + response.getContent());
}
} catch (URISyntaxException e) {
throw new RemoteOperationException("build url failed.", e);
Expand Down Expand Up @@ -194,8 +192,8 @@ public String getServiceId(Microservice microservice) throws ServiceCombExceptio
return null;
} else {
throw new RemoteOperationException(
"read response failed. status=" + response.getStatusCode() + ";message=" + response
.getStatusMessage());
"read response failed. status:" + response.getStatusCode() + "; message:" + response
.getStatusMessage() + "; content:" + response.getContent());
}
} catch (URISyntaxException e) {
throw new RemoteOperationException("build url failed.", e);
Expand Down Expand Up @@ -230,9 +228,9 @@ public String registerInstance(MicroserviceInstance microserviceInstance)
return result.get("instanceId");
} else {
throw new RemoteOperationException(
"read response failed. url=" + formatUrl + "status=" + response.getStatusCode()
+ ";message=" + response
.getStatusMessage());
"read response failed. url:" + formatUrl + "status:" + response.getStatusCode()
+ "; message:" + response.getStatusMessage() + "; content:" + response
.getContent());
}
} catch (URISyntaxException e) {
throw new RemoteOperationException("build url failed.", e);
Expand Down Expand Up @@ -262,9 +260,9 @@ public boolean deRegisterInstance(String serviceId, String instanceId)
return true;
} else {
throw new RemoteOperationException(
"deRegister failed. url=" + formatUrl + "status=" + response.getStatusCode()
+ ";message=" + response
.getStatusMessage());
"deRegister failed. url:" + formatUrl + "status:" + response.getStatusCode()
+ "; message:" + response.getStatusMessage() + "; content:" + response
.getContent());
}
} catch (URISyntaxException e) {
throw new RemoteOperationException("build url failed.", e);
Expand Down Expand Up @@ -310,17 +308,17 @@ public List<ServiceInstance> getInstances(Microservice microservice)
host = endpointURIBuilder.getHost();
} else {
throw new RemoteOperationException(
"read response failed. status=" + response.getStatusCode() + ";message=" + response
.getStatusMessage());
"read response failed. status:" + response.getStatusCode() + "; message:" + response
.getStatusMessage() + "; content:" + response.getContent());
}
instanceList.add(
new DefaultServiceInstance(instance.getInstanceId(), instance.getServiceId(), host,
port, false));
}
} else {
throw new RemoteOperationException(
"read response failed. status=" + response.getStatusCode() + ";message=" + response
.getStatusMessage());
"read response failed. status:" + response.getStatusCode() + "; message:" + response
.getStatusMessage() + "; content:" + response.getContent());
}
} catch (URISyntaxException e) {
throw new RemoteOperationException("build url failed.", e);
Expand All @@ -344,8 +342,8 @@ public MicroserviceInstanceSingleResponse getInstance(String serviceId, String i
.readValue(response.getContent(), MicroserviceInstanceSingleResponse.class);
} else {
throw new RemoteOperationException(
"read response failed. status=" + response.getStatusCode() + ";message=" + response
.getStatusMessage());
"read response failed. status:" + response.getStatusCode() + "; message:" + response
.getStatusMessage() + "; content:" + response.getContent());
}
} catch (URISyntaxException e) {
throw new RemoteOperationException("build url failed.", e);
Expand Down Expand Up @@ -374,8 +372,8 @@ public void heartbeat(HeartbeatRequest heartbeatRequest) throws ServiceCombExcep
LOGGER.debug("heartbeat success.");
} else {
throw new RemoteOperationException(
"read response failed. status=" + response.getStatusCode() + ";message=" + response
.getStatusMessage());
"read response failed. status:" + response.getStatusCode() + "; message:" + response
.getStatusMessage()+ "; content:" + response.getContent());
}
} catch (URISyntaxException e) {
throw new RemoteOperationException("build url failed.", e);
Expand All @@ -399,9 +397,8 @@ public boolean updateInstanceStatus(String serviceId, String instanceId, String
return true;
}
throw new RemoteOperationException(
"update instance status failed. status=" + response.getStatusCode() + ";message="
+ response
.getStatusMessage());
"update instance status failed. status:" + response.getStatusCode() + "; message:"
+ response.getStatusMessage() + "; content:" + response.getContent());
} catch (URISyntaxException e) {
throw new RemoteOperationException("build url failed.", e);
}
Expand All @@ -418,8 +415,8 @@ public MicroserviceResponse getServices() throws ServiceCombException {
result = JsonUtils.OBJ_MAPPER.readValue(response.getContent(), MicroserviceResponse.class);
} else {
throw new RemoteOperationException(
"read response failed. status=" + response.getStatusCode() + ";message=" + response
.getStatusMessage());
"read response failed. status:" + response.getStatusCode() + "; message:" + response
.getStatusMessage() + "; content:" + response.getContent());
}
} catch (URISyntaxException e) {
throw new RemoteOperationException("build url failed.", e);
Expand Down

0 comments on commit 26e7c9f

Please sign in to comment.