Update inconsistent debugging info in catch block (#2553)

* Add stack traces information

* update stack trace info

* update stack trace to make them consistent

* update stack traces

* update stacktraces

* update stacktraces for other similar situations

* fix some other situations

* enhance other situations
This commit is contained in:
lzh3636 2018-04-16 03:07:16 -04:00 committed by dahn
parent 740adf45c2
commit 106a9a34e1
11 changed files with 18 additions and 20 deletions

View File

@ -254,9 +254,8 @@ public class CreateFirewallRuleCmd extends BaseAsyncCreateCmd implements Firewal
setEntityUuid(result.getUuid());
}
} catch (NetworkRuleConflictException ex) {
s_logger.info("Network rule conflict: " + ex.getMessage());
s_logger.trace("Network Rule Conflict: ", ex);
throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, ex.getMessage());
throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, ex.getMessage(), ex);
}
}

View File

@ -358,9 +358,8 @@ public class CreatePortForwardingRuleCmd extends BaseAsyncCreateCmd implements P
setEntityId(result.getId());
setEntityUuid(result.getUuid());
} catch (NetworkRuleConflictException ex) {
s_logger.info("Network rule conflict: ", ex);
s_logger.trace("Network Rule Conflict: ", ex);
throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, ex.getMessage());
throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, ex.getMessage(), ex);
}
}

View File

@ -91,7 +91,7 @@ public class UsageDaoImpl extends GenericDaoBase<UsageVO, Long> implements Usage
txn.commit();
} catch (Exception ex) {
txn.rollback();
s_logger.error("error retrieving usage vm instances for account id: " + accountId);
s_logger.error("error retrieving usage vm instances for account id: " + accountId, ex);
} finally {
txn.close();
}

View File

@ -237,9 +237,9 @@ public class RabbitMQEventBus extends ManagerBase implements EventBus {
s_subscribers.put(queueName, queueDetails);
} catch (AlreadyClosedException closedException) {
s_logger.warn("Connection to AMQP service is lost. Subscription:" + queueName + " will be active after reconnection");
s_logger.warn("Connection to AMQP service is lost. Subscription:" + queueName + " will be active after reconnection", closedException);
} catch (ConnectException connectException) {
s_logger.warn("Connection to AMQP service is lost. Subscription:" + queueName + " will be active after reconnection");
s_logger.warn("Connection to AMQP service is lost. Subscription:" + queueName + " will be active after reconnection", connectException);
} catch (Exception e) {
throw new EventBusException("Failed to subscribe to event due to " + e.getMessage());
}

View File

@ -68,7 +68,7 @@ public class HypervInvestigator extends AdapterBase implements Investigator {
return answer.getResult() ? Status.Down : Status.Up;
}
} catch (Exception e) {
s_logger.debug("Failed to send command to host: " + neighbor.getId());
s_logger.debug("Failed to send command to host: " + neighbor.getId(), e);
}
}

View File

@ -94,12 +94,12 @@ public class OvmFencer extends AdapterBase implements FenceBuilder {
answer = (FenceAnswer)_agentMgr.send(h.getId(), fence);
} catch (AgentUnavailableException e) {
if (s_logger.isDebugEnabled()) {
s_logger.debug("Moving on to the next host because " + h.toString() + " is unavailable");
s_logger.debug("Moving on to the next host because " + h.toString() + " is unavailable", e);
}
continue;
} catch (OperationTimedoutException e) {
if (s_logger.isDebugEnabled()) {
s_logger.debug("Moving on to the next host because " + h.toString() + " is unavailable");
s_logger.debug("Moving on to the next host because " + h.toString() + " is unavailable", e);
}
continue;
}

View File

@ -90,12 +90,12 @@ public class SimulatorFencer extends AdapterBase implements FenceBuilder {
answer = (FenceAnswer)_agentMgr.send(h.getId(), fence);
} catch (AgentUnavailableException e) {
if (s_logger.isDebugEnabled()) {
s_logger.debug("Moving on to the next host because " + h.toString() + " is unavailable");
s_logger.debug("Moving on to the next host because " + h.toString() + " is unavailable", e);
}
continue;
} catch (OperationTimedoutException e) {
if (s_logger.isDebugEnabled()) {
s_logger.debug("Moving on to the next host because " + h.toString() + " is unavailable");
s_logger.debug("Moving on to the next host because " + h.toString() + " is unavailable", e);
}
continue;
}

View File

@ -77,12 +77,12 @@ public class XenServerFencer extends AdapterBase implements FenceBuilder {
answer = (FenceAnswer)ans;
} catch (AgentUnavailableException e) {
if (s_logger.isDebugEnabled()) {
s_logger.debug("Moving on to the next host because " + h.toString() + " is unavailable");
s_logger.debug("Moving on to the next host because " + h.toString() + " is unavailable", e);
}
continue;
} catch (OperationTimedoutException e) {
if (s_logger.isDebugEnabled()) {
s_logger.debug("Moving on to the next host because " + h.toString() + " is unavailable");
s_logger.debug("Moving on to the next host because " + h.toString() + " is unavailable", e);
}
continue;
}

View File

@ -5028,14 +5028,14 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
checkForSuccess(conn, task);
} catch (final Types.HandleInvalid e) {
if (vm.getPowerState(conn) == VmPowerState.RUNNING) {
s_logger.debug("VM " + vmName + " is in Running status");
s_logger.debug("VM " + vmName + " is in Running status", e);
task = null;
return;
}
throw new CloudRuntimeException("Start VM " + vmName + " catch HandleInvalid and VM is not in RUNNING state");
} catch (final TimeoutException e) {
if (vm.getPowerState(conn) == VmPowerState.RUNNING) {
s_logger.debug("VM " + vmName + " is in Running status");
s_logger.debug("VM " + vmName + " is in Running status", e);
task = null;
return;
}

View File

@ -99,10 +99,10 @@ public class KVMFencer extends AdapterBase implements FenceBuilder {
try {
answer = (FenceAnswer)_agentMgr.send(h.getId(), fence);
} catch (AgentUnavailableException e) {
s_logger.info("Moving on to the next host because " + h.toString() + " is unavailable");
s_logger.info("Moving on to the next host because " + h.toString() + " is unavailable", e);
continue;
} catch (OperationTimedoutException e) {
s_logger.info("Moving on to the next host because " + h.toString() + " is unavailable");
s_logger.info("Moving on to the next host because " + h.toString() + " is unavailable", e);
continue;
}
if (answer != null && answer.getResult()) {

View File

@ -715,10 +715,10 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio
kStream.write(key.getBytes());
}
} catch (FileNotFoundException e) {
s_logger.warn("Failed to write key to " + keyfile.getAbsolutePath());
s_logger.warn("Failed to write key to " + keyfile.getAbsolutePath(), e);
throw new CloudRuntimeException("Failed to update keypairs on disk: cannot find key file " + keyPath);
} catch (IOException e) {
s_logger.warn("Failed to write key to " + keyfile.getAbsolutePath());
s_logger.warn("Failed to write key to " + keyfile.getAbsolutePath(), e);
throw new CloudRuntimeException("Failed to update keypairs on disk: cannot write to key file " + keyPath);
}
}