From 3247e2b9a3f2b0e058bbe45a8dd039b82efdad4c Mon Sep 17 00:00:00 2001 From: stack Date: Tue, 5 Aug 2014 15:14:33 -0700 Subject: [PATCH] HBASE-11603 Apply version of HADOOP-8027 to our JMXJsonServlet Changed fail get of attributes -- a usual affair -- introspecting JMX beans to log at trace rather than at debug. Was annoying. --- .../apache/hadoop/hbase/http/jmx/JMXJsonServlet.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/http/jmx/JMXJsonServlet.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/http/jmx/JMXJsonServlet.java index 3a7f798..765b8fd 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/http/jmx/JMXJsonServlet.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/http/jmx/JMXJsonServlet.java @@ -225,7 +225,7 @@ public class JMXJsonServlet extends HttpServlet { private void listBeans(JsonGenerator jg, ObjectName qry, String attribute, HttpServletResponse response) throws IOException { - LOG.debug("Listing beans for "+qry); + LOG.trace("Listing beans for "+qry); Set names = null; names = mBeanServer.queryNames(qry, null); @@ -245,7 +245,7 @@ public class JMXJsonServlet extends HttpServlet { prs = "modelerType"; code = (String) mBeanServer.getAttribute(oname, prs); } - if (attribute!=null) { + if (attribute != null) { prs = attribute; attributeinfo = mBeanServer.getAttribute(oname, prs); } @@ -253,9 +253,11 @@ public class JMXJsonServlet extends HttpServlet { // UnsupportedOperationExceptions happen in the normal course of business, // so no need to log them as errors all the time. if (e.getCause() instanceof UnsupportedOperationException) { - LOG.debug("getting attribute " + oname + " of "+oname+" threw an exception", e); + if (LOG.isTraceEnabled()) { + LOG.trace("Getting attribute " + prs + " of " + oname + " threw " + e); + } } else { - LOG.error("getting attribute " + oname + " of "+oname+" threw an exception", e); + LOG.error("Getting attribute " + prs + " of " + oname + " threw an exception", e); } return; } catch (AttributeNotFoundException e) { @@ -326,7 +328,8 @@ public class JMXJsonServlet extends HttpServlet { jg.writeEndArray(); } - private void writeAttribute(JsonGenerator jg, ObjectName oname, MBeanAttributeInfo attr) throws IOException { + private void writeAttribute(JsonGenerator jg, ObjectName oname, MBeanAttributeInfo attr) + throws IOException { if (!attr.isReadable()) { return; } @@ -345,7 +348,9 @@ public class JMXJsonServlet extends HttpServlet { // UnsupportedOperationExceptions happen in the normal course of business, // so no need to log them as errors all the time. if (e.getCause() instanceof UnsupportedOperationException) { - LOG.debug("getting attribute "+attName+" of "+oname+" threw an exception", e); + if (LOG.isTraceEnabled()) { + LOG.trace("Getting attribute " + attName + " of " + oname + " threw " + e); + } } else { LOG.error("getting attribute "+attName+" of "+oname+" threw an exception", e); } -- 1.8.5.2 (Apple Git-48)