CLOUDSTACK-10357: Improve log messages in methods (#2580)

Fix several logs that mismatch method.
Add stacktraces for throw new statements.
This commit is contained in:
lzh3636 2018-04-19 15:03:27 -04:00 committed by Rohit Yadav
parent fbf07fa565
commit fed3492b57
12 changed files with 17 additions and 17 deletions

View File

@ -246,7 +246,7 @@ public class ConsoleProxyResource extends ServerResourceBase implements ServerRe
}
String internalDns1 = (String) params.get("internaldns1");
if (internalDns1 == null) {
s_logger.warn("No DNS entry found during configuration of NfsSecondaryStorage");
s_logger.warn("No DNS entry found during configuration of ConsoleProxy");
} else {
addRouteToInternalIpOrCidr(_localgw, _eth1ip, _eth1mask, internalDns1);
}

View File

@ -410,7 +410,7 @@ public class UserVmDaoImpl extends GenericDaoBase<UserVmVO, Long> implements Use
}
catch (Exception e)
{
s_logger.error("listVmDetails:Exception:" + e.getMessage());
s_logger.error("listPodIdsHavingVmsforAccount:Exception:" + e.getMessage());
}
}

View File

@ -497,8 +497,8 @@ public class DedicatedResourceManagerImpl implements DedicatedService {
}
dedicatedResource = _dedicatedDao.persist(dedicatedResource);
} catch (Exception e) {
s_logger.error("Unable to dedicate host due to " + e.getMessage(), e);
throw new CloudRuntimeException("Failed to dedicate cluster. Please contact Cloud Support.");
s_logger.error("Unable to dedicate cluster due to " + e.getMessage(), e);
throw new CloudRuntimeException("Failed to dedicate cluster. Please contact Cloud Support.", e);
}
List<DedicatedResourceVO> result = new ArrayList<DedicatedResourceVO>();
@ -595,7 +595,7 @@ public class DedicatedResourceManagerImpl implements DedicatedService {
dedicatedResource = _dedicatedDao.persist(dedicatedResource);
} catch (Exception e) {
s_logger.error("Unable to dedicate host due to " + e.getMessage(), e);
throw new CloudRuntimeException("Failed to dedicate host. Please contact Cloud Support.");
throw new CloudRuntimeException("Failed to dedicate host. Please contact Cloud Support.", e);
}
List<DedicatedResourceVO> result = new ArrayList<DedicatedResourceVO>();

View File

@ -64,8 +64,8 @@ public class DeleteBaremetalRctCmd extends BaseAsyncCmd {
SuccessResponse response = new SuccessResponse(getCommandName());
setResponseObject(response);
} catch (Exception e) {
s_logger.warn(String.format("unable to add baremetal RCT[%s]", getId()), e);
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
s_logger.warn(String.format("unable to delete baremetal RCT[%s]", getId()), e);
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage(), e);
}
}

View File

@ -1309,10 +1309,10 @@ public class KVMStorageProcessor implements StorageProcessor {
return new DettachAnswer(disk);
} catch (final LibvirtException e) {
s_logger.debug("Failed to attach volume: " + vol.getPath() + ", due to ", e);
s_logger.debug("Failed to detach volume: " + vol.getPath() + ", due to ", e);
return new DettachAnswer(e.toString());
} catch (final InternalErrorException e) {
s_logger.debug("Failed to attach volume: " + vol.getPath() + ", due to ", e);
s_logger.debug("Failed to detach volume: " + vol.getPath() + ", due to ", e);
return new DettachAnswer(e.toString());
}
}

View File

@ -324,7 +324,7 @@ public class CloudianClient {
final HttpResponse response = post("/group", group);
return response.getStatusLine().getStatusCode() == HttpStatus.SC_OK;
} catch (final IOException e) {
LOG.error("Failed to remove group due to:", e);
LOG.error("Failed to update group due to:", e);
checkResponseTimeOut(e);
}
return false;

View File

@ -785,7 +785,7 @@ public class NetScalerControlCenterResource implements ServerResource {
// use Apache.
String logMessage = StringEscapeUtils.unescapeJava(jsonCmd);
logMessage = cleanPassword(logMessage);
s_logger.debug("POST request to " + agentUri.toString()
s_logger.debug("GET request to " + agentUri.toString()
+ " with contents " + logMessage);
// Create request

View File

@ -189,7 +189,7 @@ public class NuageVspResource extends ManagerBase implements ServerResource, Vsp
try {
JmxUtil.unregisterMBean("NuageVspResource", _name);
} catch (Exception e) {
s_logger.warn("Unable to initialize inaccurate clock", e);
s_logger.warn("Unable to stop NuageVspResource", e);
}
return true;

View File

@ -1731,7 +1731,7 @@ public class NetworkModelImpl extends ManagerBase implements NetworkModel, Confi
}
} catch (Exception ex) {
if (s_logger.isDebugEnabled()) {
s_logger.debug("Failed to retrive the default label for management traffic:" + "zone: " + dcId + " hypervisor: " + hypervisorType + " due to:" +
s_logger.debug("Failed to retrive the default label for guest traffic:" + "zone: " + dcId + " hypervisor: " + hypervisorType + " due to:" +
ex.getMessage());
}
}

View File

@ -1482,7 +1482,7 @@ public class AutoScaleManagerImpl<Type> extends ManagerBase implements AutoScale
public void doScaleDown(final long groupId) {
AutoScaleVmGroupVO asGroup = _autoScaleVmGroupDao.findById(groupId);
if (asGroup == null) {
s_logger.error("Can not find the groupid " + groupId + " for scaling up");
s_logger.error("Can not find the groupid " + groupId + " for scaling down");
return;
}
if (!checkConditionDown(asGroup)) {

View File

@ -97,7 +97,7 @@ public class HostDatastoreBrowserMO extends BaseMO {
}
} finally {
if (s_logger.isTraceEnabled())
s_logger.trace("vCenter API trace - searchDatastore() done");
s_logger.trace("vCenter API trace - searchDatastoreSubFolders() done");
}
return null;

View File

@ -1492,14 +1492,14 @@ public class VirtualMachineMO extends BaseMO {
if (!result) {
if (s_logger.isTraceEnabled())
s_logger.trace("vCenter API trace - detachIso() done(failed)");
s_logger.trace("vCenter API trace - attachIso() done(failed)");
throw new Exception("Failed to attach ISO due to " + TaskMO.getTaskFailureInfo(_context, morTask));
}
_context.waitForTaskProgressDone(morTask);
if (s_logger.isTraceEnabled())
s_logger.trace("vCenter API trace - detachIso() done(successfully)");
s_logger.trace("vCenter API trace - attachIso() done(successfully)");
}
public int detachIso(String isoDatastorePath) throws Exception {