Repository: asterixdb Updated Branches: refs/heads/master 709273a84 -> 4d7899dd8
Fix Logging Of Metadata Stores Change-Id: Ic40cb5f385441089ee1d3f868ddb5add404a6426 Reviewed-on: https://asterix-gerrit.ics.uci.edu/1279 Sonar-Qube: Jenkins <jenk...@fulliautomatix.ics.uci.edu> Tested-by: Jenkins <jenk...@fulliautomatix.ics.uci.edu> Integration-Tests: Jenkins <jenk...@fulliautomatix.ics.uci.edu> Reviewed-by: Till Westmann <ti...@apache.org> Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/4d7899dd Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/4d7899dd Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/4d7899dd Branch: refs/heads/master Commit: 4d7899dd842983e76f51e1d6803de77cba8b4f11 Parents: 709273a Author: Michael Blow <mb...@apache.org> Authored: Thu Oct 13 14:05:24 2016 -0400 Committer: Michael Blow <mb...@apache.org> Committed: Thu Oct 13 14:51:01 2016 -0700 ---------------------------------------------------------------------- .../bootstrap/NCApplicationEntryPoint.java | 3 +- .../apache/asterix/common/utils/PrintUtil.java | 48 ++++++++++++++++++++ 2 files changed, 50 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/asterixdb/blob/4d7899dd/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/NCApplicationEntryPoint.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/NCApplicationEntryPoint.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/NCApplicationEntryPoint.java index e6f3142..ea1f714 100644 --- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/NCApplicationEntryPoint.java +++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/NCApplicationEntryPoint.java @@ -39,6 +39,7 @@ import org.apache.asterix.common.config.MessagingProperties; import org.apache.asterix.common.replication.IRemoteRecoveryManager; import org.apache.asterix.common.transactions.IRecoveryManager; import org.apache.asterix.common.transactions.IRecoveryManager.SystemState; +import org.apache.asterix.common.utils.PrintUtil; import org.apache.asterix.common.utils.StoragePathUtil; import org.apache.asterix.event.schema.cluster.Cluster; import org.apache.asterix.event.schema.cluster.Node; @@ -209,7 +210,7 @@ public class NCApplicationEntryPoint implements INCApplicationEntryPoint { if (LOGGER.isLoggable(Level.INFO)) { LOGGER.info("System state: " + SystemState.NEW_UNIVERSE); LOGGER.info("Node ID: " + nodeId); - LOGGER.info("Stores: " + metadataProperties.getStores()); + LOGGER.info("Stores: " + PrintUtil.toString(metadataProperties.getStores())); LOGGER.info("Root Metadata Store: " + metadataProperties.getStores().get(nodeId)[0]); } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/4d7899dd/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/utils/PrintUtil.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/utils/PrintUtil.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/utils/PrintUtil.java new file mode 100644 index 0000000..8c0e4ff --- /dev/null +++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/utils/PrintUtil.java @@ -0,0 +1,48 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.asterix.common.utils; + +import java.util.Arrays; +import java.util.Iterator; +import java.util.Map; + +public class PrintUtil { + private PrintUtil() { + } + + public static String toString(Map<String, ? extends Object[]> map) { + Iterator<? extends Map.Entry<String, ? extends Object[]>> iter = map.entrySet().iterator(); + if (!iter.hasNext()) { + return "{}"; + } + StringBuilder sb = new StringBuilder(); + sb.append('{'); + while (true) { + Map.Entry<String, ? extends Object[]> entry = iter.next(); + sb.append(entry.getKey()); + sb.append('='); + sb.append(Arrays.toString(entry.getValue())); + if (! iter.hasNext()) { + break; + } + sb.append(',').append(' '); + } + return sb.append('}').toString(); + } +}