Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id F1480200C7F for ; Wed, 24 May 2017 18:24:32 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id EFE69160BB4; Wed, 24 May 2017 16:24:32 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 41BD1160B9C for ; Wed, 24 May 2017 18:24:32 +0200 (CEST) Received: (qmail 74297 invoked by uid 500); 24 May 2017 16:24:31 -0000 Mailing-List: contact commits-help@phoenix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@phoenix.apache.org Delivered-To: mailing list commits@phoenix.apache.org Received: (qmail 74287 invoked by uid 99); 24 May 2017 16:24:31 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 May 2017 16:24:31 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 44A5ADFC2E; Wed, 24 May 2017 16:24:31 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: samarth@apache.org To: commits@phoenix.apache.org Message-Id: <026e2c3f3172450987e34e3197c5f65b@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: phoenix git commit: PHOENIX-3826 Improve logging when HConnection is established(Loknath Priyatham Teja Singamsetty) Date: Wed, 24 May 2017 16:24:31 +0000 (UTC) archived-at: Wed, 24 May 2017 16:24:33 -0000 Repository: phoenix Updated Branches: refs/heads/4.10-HBase-0.98 0e87092d5 -> f2611e78e 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/f2611e78 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/f2611e78 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/f2611e78 Branch: refs/heads/4.10-HBase-0.98 Commit: f2611e78ec43c02b4b8c316a3f66a8d3c7379f0a Parents: 0e87092 Author: Samarth Jain Authored: Wed May 24 09:24:28 2017 -0700 Committer: Samarth Jain Committed: Wed May 24 09:24:28 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/f2611e78/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 14e31d2..76f6393 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) { @@ -2398,7 +2399,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/f2611e78/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(); + } }