Skip to content

Commit fed3492

Browse files
lzh3636yadvr
authored andcommitted
CLOUDSTACK-10357: Improve log messages in methods (#2580)
Fix several logs that mismatch method. Add stacktraces for throw new statements.
1 parent fbf07fa commit fed3492

12 files changed

Lines changed: 17 additions & 17 deletions

File tree

agent/src/main/java/com/cloud/agent/resource/consoleproxy/ConsoleProxyResource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ public boolean configure(String name, Map<String, Object> params) throws Configu
246246
}
247247
String internalDns1 = (String) params.get("internaldns1");
248248
if (internalDns1 == null) {
249-
s_logger.warn("No DNS entry found during configuration of NfsSecondaryStorage");
249+
s_logger.warn("No DNS entry found during configuration of ConsoleProxy");
250250
} else {
251251
addRouteToInternalIpOrCidr(_localgw, _eth1ip, _eth1mask, internalDns1);
252252
}

engine/schema/src/main/java/com/cloud/vm/dao/UserVmDaoImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ public List<Long> listPodIdsHavingVmsforAccount(long zoneId, long accountId) {
410410
}
411411
catch (Exception e)
412412
{
413-
s_logger.error("listVmDetails:Exception:" + e.getMessage());
413+
s_logger.error("listPodIdsHavingVmsforAccount:Exception:" + e.getMessage());
414414
}
415415
}
416416

plugins/dedicated-resources/src/main/java/org/apache/cloudstack/dedicated/DedicatedResourceManagerImpl.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -497,8 +497,8 @@ public List<DedicatedResourceVO> doInTransaction(TransactionStatus status) {
497497
}
498498
dedicatedResource = _dedicatedDao.persist(dedicatedResource);
499499
} catch (Exception e) {
500-
s_logger.error("Unable to dedicate host due to " + e.getMessage(), e);
501-
throw new CloudRuntimeException("Failed to dedicate cluster. Please contact Cloud Support.");
500+
s_logger.error("Unable to dedicate cluster due to " + e.getMessage(), e);
501+
throw new CloudRuntimeException("Failed to dedicate cluster. Please contact Cloud Support.", e);
502502
}
503503

504504
List<DedicatedResourceVO> result = new ArrayList<DedicatedResourceVO>();
@@ -595,7 +595,7 @@ public List<DedicatedResourceVO> doInTransaction(TransactionStatus status) {
595595
dedicatedResource = _dedicatedDao.persist(dedicatedResource);
596596
} catch (Exception e) {
597597
s_logger.error("Unable to dedicate host due to " + e.getMessage(), e);
598-
throw new CloudRuntimeException("Failed to dedicate host. Please contact Cloud Support.");
598+
throw new CloudRuntimeException("Failed to dedicate host. Please contact Cloud Support.", e);
599599
}
600600

601601
List<DedicatedResourceVO> result = new ArrayList<DedicatedResourceVO>();

plugins/hypervisors/baremetal/src/main/java/org/apache/cloudstack/api/DeleteBaremetalRctCmd.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ public void execute() throws ResourceUnavailableException, InsufficientCapacityE
6464
SuccessResponse response = new SuccessResponse(getCommandName());
6565
setResponseObject(response);
6666
} catch (Exception e) {
67-
s_logger.warn(String.format("unable to add baremetal RCT[%s]", getId()), e);
68-
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
67+
s_logger.warn(String.format("unable to delete baremetal RCT[%s]", getId()), e);
68+
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage(), e);
6969
}
7070
}
7171

plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1309,10 +1309,10 @@ public Answer dettachVolume(final DettachCommand cmd) {
13091309

13101310
return new DettachAnswer(disk);
13111311
} catch (final LibvirtException e) {
1312-
s_logger.debug("Failed to attach volume: " + vol.getPath() + ", due to ", e);
1312+
s_logger.debug("Failed to detach volume: " + vol.getPath() + ", due to ", e);
13131313
return new DettachAnswer(e.toString());
13141314
} catch (final InternalErrorException e) {
1315-
s_logger.debug("Failed to attach volume: " + vol.getPath() + ", due to ", e);
1315+
s_logger.debug("Failed to detach volume: " + vol.getPath() + ", due to ", e);
13161316
return new DettachAnswer(e.toString());
13171317
}
13181318
}

plugins/integrations/cloudian/src/main/java/org/apache/cloudstack/cloudian/client/CloudianClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ public boolean updateGroup(final CloudianGroup group) {
324324
final HttpResponse response = post("/group", group);
325325
return response.getStatusLine().getStatusCode() == HttpStatus.SC_OK;
326326
} catch (final IOException e) {
327-
LOG.error("Failed to remove group due to:", e);
327+
LOG.error("Failed to update group due to:", e);
328328
checkResponseTimeOut(e);
329329
}
330330
return false;

plugins/network-elements/netscaler/src/main/java/com/cloud/network/resource/NetScalerControlCenterResource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,7 @@ public static String getHttpRequest(final String jsonCmd, final URI agentUri, St
785785
// use Apache.
786786
String logMessage = StringEscapeUtils.unescapeJava(jsonCmd);
787787
logMessage = cleanPassword(logMessage);
788-
s_logger.debug("POST request to " + agentUri.toString()
788+
s_logger.debug("GET request to " + agentUri.toString()
789789
+ " with contents " + logMessage);
790790

791791
// Create request

plugins/network-elements/nuage-vsp/src/main/java/com/cloud/network/resource/NuageVspResource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ public boolean stop() {
189189
try {
190190
JmxUtil.unregisterMBean("NuageVspResource", _name);
191191
} catch (Exception e) {
192-
s_logger.warn("Unable to initialize inaccurate clock", e);
192+
s_logger.warn("Unable to stop NuageVspResource", e);
193193
}
194194

195195
return true;

server/src/main/java/com/cloud/network/NetworkModelImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1731,7 +1731,7 @@ public String getDefaultGuestTrafficLabel(long dcId, HypervisorType hypervisorTy
17311731
}
17321732
} catch (Exception ex) {
17331733
if (s_logger.isDebugEnabled()) {
1734-
s_logger.debug("Failed to retrive the default label for management traffic:" + "zone: " + dcId + " hypervisor: " + hypervisorType + " due to:" +
1734+
s_logger.debug("Failed to retrive the default label for guest traffic:" + "zone: " + dcId + " hypervisor: " + hypervisorType + " due to:" +
17351735
ex.getMessage());
17361736
}
17371737
}

server/src/main/java/com/cloud/network/as/AutoScaleManagerImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1482,7 +1482,7 @@ public void doScaleUp(long groupId, Integer numVm) {
14821482
public void doScaleDown(final long groupId) {
14831483
AutoScaleVmGroupVO asGroup = _autoScaleVmGroupDao.findById(groupId);
14841484
if (asGroup == null) {
1485-
s_logger.error("Can not find the groupid " + groupId + " for scaling up");
1485+
s_logger.error("Can not find the groupid " + groupId + " for scaling down");
14861486
return;
14871487
}
14881488
if (!checkConditionDown(asGroup)) {

0 commit comments

Comments
 (0)