From dev-return-80468-archive-asf-public=cust-asf.ponee.io@zookeeper.apache.org Fri Apr 26 14:39:01 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id 12A3118064C for ; Fri, 26 Apr 2019 16:39:00 +0200 (CEST) Received: (qmail 27379 invoked by uid 500); 26 Apr 2019 14:39:00 -0000 Mailing-List: contact dev-help@zookeeper.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@zookeeper.apache.org Delivered-To: mailing list dev@zookeeper.apache.org Received: (qmail 27348 invoked by uid 99); 26 Apr 2019 14:39:00 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 Apr 2019 14:39:00 +0000 From: GitBox To: dev@zookeeper.apache.org Subject: [GitHub] [zookeeper] BELUGABEHR commented on a change in pull request #878: ZOOKEEPER-3339: Improve Debug and Trace Log Statements Message-ID: <155628954014.16477.8614153646929372274.gitbox@gitbox.apache.org> Date: Fri, 26 Apr 2019 14:39:00 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit BELUGABEHR commented on a change in pull request #878: ZOOKEEPER-3339: Improve Debug and Trace Log Statements URL: https://github.com/apache/zookeeper/pull/878#discussion_r278977710 ########## File path: zookeeper-server/src/main/java/org/apache/zookeeper/server/NIOServerCnxn.java ########## @@ -610,11 +604,14 @@ private void closeSock() { return; } - LOG.debug("Closed socket connection for client " - + sock.socket().getRemoteSocketAddress() - + (sessionId != 0 ? - " which had sessionid 0x" + Long.toHexString(sessionId) : - " (no session established for client)")); + if (LOG.isDebugEnabled()) { Review comment: The idea with parameter logging in SLF4J is that it avoids doing any real work unless the specified log-level is met. In this example, parameters could of course be used, but the code would still call `Long.toHexString(sessionId)` for every iteration and the results of that work would be thrown away (unless debug logging is enabled). It also has to deal with that conditional. It's better just to skip this code altogether if debug logs are disabled. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org With regards, Apache Git Services