improve logging

This commit is contained in:
kimchy 2010-02-25 09:03:52 +02:00
parent 9eaa50ce62
commit f5a4296bf7
1 changed files with 3 additions and 4 deletions

View File

@ -165,15 +165,14 @@ public class DefaultClusterService extends AbstractComponent implements ClusterS
clusterState = newClusterStateBuilder().state(clusterState).incrementVersion().build(); clusterState = newClusterStateBuilder().state(clusterState).incrementVersion().build();
} }
if (logger.isDebugEnabled()) {
logger.debug("Cluster state updated, version [{}], source [{}]", clusterState.version(), source);
}
if (logger.isTraceEnabled()) { if (logger.isTraceEnabled()) {
StringBuilder sb = new StringBuilder("Cluster State:\n"); StringBuilder sb = new StringBuilder("Cluster State updated, version [").append(clusterState.version()).append("], source [").append(source).append("]\n");
sb.append(clusterState.nodes().prettyPrint()); sb.append(clusterState.nodes().prettyPrint());
sb.append(clusterState.routingTable().prettyPrint()); sb.append(clusterState.routingTable().prettyPrint());
sb.append(clusterState.routingNodes().prettyPrint()); sb.append(clusterState.routingNodes().prettyPrint());
logger.trace(sb.toString()); logger.trace(sb.toString());
} else if (logger.isDebugEnabled()) {
logger.debug("Cluster state updated, version [{}], source [{}]", clusterState.version(), source);
} }
ClusterChangedEvent clusterChangedEvent = new ClusterChangedEvent(source, clusterState, previousClusterState, discoveryService.firstMaster()); ClusterChangedEvent clusterChangedEvent = new ClusterChangedEvent(source, clusterState, previousClusterState, discoveryService.firstMaster());