Fix Logging Of Metadata Stores
Change-Id: Ic40cb5f385441089ee1d3f868ddb5add404a6426
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1279
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Till Westmann <tillw@apache.org>
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.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 @@
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]);
}
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();
+ }
+}