Michael Blow has uploaded a new change for review.

  https://asterix-gerrit.ics.uci.edu/1279

Change subject: Fix Logging Of Metadata Stores
......................................................................

Fix Logging Of Metadata Stores

Change-Id: Ic40cb5f385441089ee1d3f868ddb5add404a6426
---
M 
asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/NCApplicationEntryPoint.java
A 
asterixdb/asterix-common/src/main/java/org/apache/asterix/common/utils/PrintUtil.java
2 files changed, 47 insertions(+), 1 deletion(-)


  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb 
refs/changes/79/1279/1

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..91a29db
--- /dev/null
+++ 
b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/utils/PrintUtil.java
@@ -0,0 +1,45 @@
+/*
+ * 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 {
+    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();
+    }
+}

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/1279
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic40cb5f385441089ee1d3f868ddb5add404a6426
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Michael Blow <mb...@apache.org>

Reply via email to