tuning logs

This commit is contained in:
Adrian Cole 2011-01-23 23:18:39 -08:00
parent b1b29ec222
commit 5ba249ae46
5 changed files with 17 additions and 37 deletions

View File

@ -115,8 +115,10 @@ public class RunScriptOnNodeAsInitScriptUsingSsh implements RunScriptOnNode {
ExecResponse returnVal;
String command = (runAsRoot) ? execScriptAsRoot(action) : execScriptAsDefaultUser(action);
returnVal = runCommand(command);
logger.debug("<< %s(%d)", action, returnVal.getExitCode());
logger.trace("<< %s[%s]", action, returnVal);
if (logger.isTraceEnabled())
logger.trace("<< %s[%s]", action, returnVal);
else
logger.debug("<< %s(%d)", action, returnVal.getExitCode());
return returnVal;
}

View File

@ -425,10 +425,10 @@ public class BaseComputeService implements ComputeService {
@Override
public void suspendNode(String id) {
checkNotNull(id, "id");
logger.debug(">> suspendping node(%s)", id);
logger.debug(">> suspending node(%s)", id);
NodeMetadata node = suspendNodeStrategy.suspendNode(id);
boolean successful = nodeSuspended.apply(node);
logger.debug("<< suspendped node(%s) success(%s)", id, successful);
logger.debug("<< suspended node(%s) success(%s)", id, successful);
}
/**
@ -528,7 +528,7 @@ public class BaseComputeService implements ComputeService {
Iterable<? extends NodeMetadata> nodes, Statement script, RunScriptOptions options,
Map<NodeMetadata, Exception> badNodes) {
return filter(transformParallel(nodes, new TransformNodesIntoInitializedScriptRunners(script, options, badNodes),
executor, null, logger, "transformNodesIntoInitializedScriptRunners(" + nodes + ")"), notNull());
executor, null, logger, "initialize script runners"), notNull());
}
private Set<? extends NodeMetadata> detailsOnAllNodes() {

View File

@ -85,63 +85,43 @@ public class AdaptingComputeServiceStrategies<N, H, I, L> implements AddNodeWith
@Override
public NodeMetadata getNode(String id) {
N node = client.getNode(id);
N node = client.getNode(checkNotNull(id, "id"));
return node == null ? null : nodeMetadataAdapter.apply(node);
}
@Override
public NodeMetadata rebootNode(String id) {
NodeMetadata node = getNode(id);
NodeMetadata node = getNode(checkNotNull(id, "id"));
if (node == null || node.getState() == NodeState.TERMINATED)
return node;
logger.debug(">> rebooting node(%s)", id);
client.rebootNode(id);
logger.debug("<< rebooted node(%s)", id);
return node;
}
@Override
public NodeMetadata resumeNode(String id) {
NodeMetadata node = getNode(id);
NodeMetadata node = getNode(checkNotNull(id, "id"));
if (node == null || node.getState() == NodeState.TERMINATED || node.getState() == NodeState.RUNNING)
return node;
logger.debug(">> resuming node(%s)", id);
client.resumeNode(id);
logger.debug("<< resumed node(%s)", id);
return node;
}
@Override
public NodeMetadata suspendNode(String id) {
NodeMetadata node = getNode(id);
NodeMetadata node = getNode(checkNotNull(id, "id"));
if (node == null || node.getState() == NodeState.TERMINATED || node.getState() == NodeState.SUSPENDED)
return node;
logger.debug(">> suspending node(%s)", id);
client.suspendNode(id);
logger.debug("<< suspended node(%s)", id);
return node;
}
@Override
public NodeMetadata destroyNode(String id) {
NodeMetadata node = getNode(id);
NodeMetadata node = getNode(checkNotNull(id, "id"));
if (node == null)
return node;
logger.debug(">> destroying node(%s)", id);
client.destroyNode(id);
logger.debug("<< destroyed node(%s)", id);
return node;
}
@ -152,14 +132,10 @@ public class AdaptingComputeServiceStrategies<N, H, I, L> implements AddNodeWith
public NodeMetadata addNodeWithTag(String tag, String name, Template template) {
checkState(tag != null, "tag (that which groups identical nodes together) must be specified");
checkState(name != null && name.indexOf(tag) != -1, "name should have %s encoded into it", tag);
logger.debug(">> instantiating node location(%s) name(%s) image(%s) hardware(%s)",
template.getLocation().getId(), name, template.getImage().getProviderId(), template.getHardware()
.getProviderId());
checkState(template != null, "template must be specified");
N from = client.runNodeWithTagAndNameAndStoreCredentials(tag, name, template, credentialStore);
NodeMetadata node = nodeMetadataAdapter.apply(from);
logger.debug("<< instantiated node(%s)", node.getId());
return node;
}

View File

@ -75,7 +75,9 @@ public class EncodeTagIntoNameRunNodesAndAddToSetStrategy implements RunNodesAnd
@Override
public NodeMetadata call() throws Exception {
NodeMetadata node = null;
logger.debug(">> starting node(%s) tag(%s)", name, tag);
logger.debug(">> adding node location(%s) name(%s) image(%s) hardware(%s)",
template.getLocation().getId(), name, template.getImage().getProviderId(), template.getHardware()
.getProviderId());
node = addNodeWithTagStrategy.addNodeWithTag(tag, name, template);
logger.debug("<< %s node(%s)", node.getState(), node.getId());
return node;

View File

@ -46,7 +46,7 @@ public class ExecResponse implements CustomizationResponse {
@Override
public String toString() {
return "ExecResponse [output=" + output + ", error=" + error + ", exitCode=" + exitCode + "]";
return "[output=" + output + ", error=" + error + ", exitCode=" + exitCode + "]";
}
@Override