Repository: phoenix Updated Branches: refs/heads/4.10-HBase-1.2 28d7eb1c9 -> ac5c33db1
PHOENIX-3826 Improve logging when HConnection is established(Loknath Priyatham Teja Singamsetty) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/ac5c33db Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/ac5c33db Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/ac5c33db Branch: refs/heads/4.10-HBase-1.2 Commit: ac5c33db1f3145afc0db27da19107fc97a5e72b0 Parents: 28d7eb1 Author: Samarth Jain <sama...@apache.org> Authored: Wed May 24 09:25:23 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Wed May 24 09:25:23 2017 -0700 ---------------------------------------------------------------------- .../apache/phoenix/query/ConnectionQueryServicesImpl.java | 5 +++-- .../src/main/java/org/apache/phoenix/util/LogUtil.java | 10 ++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/phoenix/blob/ac5c33db/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java index 59252ad..8224ccc 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java @@ -223,6 +223,7 @@ import org.apache.phoenix.util.ByteUtil; import org.apache.phoenix.util.Closeables; import org.apache.phoenix.util.ConfigUtil; import org.apache.phoenix.util.JDBCUtil; +import org.apache.phoenix.util.LogUtil; import org.apache.phoenix.util.MetaDataUtil; import org.apache.phoenix.util.PhoenixContextExecutor; import org.apache.phoenix.util.PhoenixRuntime; @@ -431,7 +432,7 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement QueryServicesOptions.DEFAULT_TRANSACTIONS_ENABLED); this.connection = HBaseFactoryProvider.getHConnectionFactory().createConnection(this.config); GLOBAL_HCONNECTIONS_COUNTER.increment(); - logger.info("HConnnection established. Details: " + connection + " " + Throwables.getStackTraceAsString(new Exception())); + logger.info("HConnection established. Stacktrace for informational purposes: " + connection + " " + LogUtil.getCallerStackTrace()); // only initialize the tx service client if needed and if we succeeded in getting a connection // to HBase if (transactionsEnabled) { @@ -2402,7 +2403,7 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement boolean success = false; try { GLOBAL_QUERY_SERVICES_COUNTER.increment(); - logger.info("An instance of ConnectionQueryServices was created: " + Throwables.getStackTraceAsString(new Exception())); + logger.info("An instance of ConnectionQueryServices was created."); openConnection(); hConnectionEstablished = true; boolean isDoNotUpgradePropSet = UpgradeUtil.isNoUpgradeSet(props); http://git-wip-us.apache.org/repos/asf/phoenix/blob/ac5c33db/phoenix-core/src/main/java/org/apache/phoenix/util/LogUtil.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/LogUtil.java b/phoenix-core/src/main/java/org/apache/phoenix/util/LogUtil.java index 21dec13..7ebdbb4 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/util/LogUtil.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/util/LogUtil.java @@ -50,4 +50,14 @@ public class LogUtil { return con.getCustomTracingAnnotations().toString(); } } + + public static String getCallerStackTrace() { + StackTraceElement[] st = Thread.currentThread().getStackTrace(); + StringBuilder sb = new StringBuilder(); + for (StackTraceElement element : st) { + sb.append(element.toString()); + sb.append("\n"); + } + return sb.toString(); + } }