This is an automated email from the ASF dual-hosted git repository. rombert pushed a commit to annotated tag org.apache.sling.hc.support-1.0.4 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-support.git
commit baa4b252d0f8d7cc05cfa1497453b365e2c2279f Author: Bertrand Delacretaz <[email protected]> AuthorDate: Thu Aug 15 14:35:25 2013 +0000 SLING-3020 - error reporting tweaks git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/healthcheck/healthchecks@1514300 13f79535-47bb-0310-9956-ffa450edef68 --- .../sling/hc/healthchecks/impl/JmxAttributeHealthCheck.java | 9 +++++---- .../hc/healthchecks/impl/SlingRequestStatusHealthCheck.java | 6 +++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/apache/sling/hc/healthchecks/impl/JmxAttributeHealthCheck.java b/src/main/java/org/apache/sling/hc/healthchecks/impl/JmxAttributeHealthCheck.java index f2ab2e4..e18767d 100644 --- a/src/main/java/org/apache/sling/hc/healthchecks/impl/JmxAttributeHealthCheck.java +++ b/src/main/java/org/apache/sling/hc/healthchecks/impl/JmxAttributeHealthCheck.java @@ -94,11 +94,12 @@ public class JmxAttributeHealthCheck implements HealthCheck { final MBeanServer jmxServer = ManagementFactory.getPlatformMBeanServer(); final ObjectName objectName = new ObjectName(mbeanName); if(jmxServer.queryNames(objectName, null).size() == 0) { - log.error("MBean not found: {}", objectName); + resultLog.warn("MBean not found: {}", objectName); + } else { + final Object value = jmxServer.getAttribute(objectName, attributeName); + resultLog.debug("{} {} returns {}", mbeanName, attributeName, value); + new SimpleConstraintChecker().check(value, constraint, resultLog); } - final Object value = jmxServer.getAttribute(objectName, attributeName); - resultLog.debug("{} {} returns {}", mbeanName, attributeName, value); - new SimpleConstraintChecker().check(value, constraint, resultLog); } catch(Exception e) { log.warn("JMX attribute {}/{} check failed: {}", new Object []{ mbeanName, attributeName, e}); resultLog.healthCheckError("JMX attribute check failed: {}", e); diff --git a/src/main/java/org/apache/sling/hc/healthchecks/impl/SlingRequestStatusHealthCheck.java b/src/main/java/org/apache/sling/hc/healthchecks/impl/SlingRequestStatusHealthCheck.java index 8b8f2c4..c2ba539 100644 --- a/src/main/java/org/apache/sling/hc/healthchecks/impl/SlingRequestStatusHealthCheck.java +++ b/src/main/java/org/apache/sling/hc/healthchecks/impl/SlingRequestStatusHealthCheck.java @@ -57,7 +57,7 @@ public class SlingRequestStatusHealthCheck implements HealthCheck { int status; String path; - PathSpec(String configuredPath) { + PathSpec(String configuredPath, FormattingResultLog resultLog) { path = configuredPath; status = 200; @@ -67,7 +67,7 @@ public class SlingRequestStatusHealthCheck implements HealthCheck { status = Integer.valueOf(parts[1].trim()); path = parts[0].trim(); } catch(NumberFormatException nfe) { - log.warn("NumberFormatException while parsing [{}], invalid status value?", configuredPath); + resultLog.healthCheckError("NumberFormatException while parsing [{}], invalid status value?", configuredPath); } } } @@ -111,7 +111,7 @@ public class SlingRequestStatusHealthCheck implements HealthCheck { resolver = resolverFactory.getAdministrativeResourceResolver(null); for(String p : paths) { lastPath = p; - final PathSpec ps = new PathSpec(p); + final PathSpec ps = new PathSpec(p, resultLog); final HttpServletRequest request = new InternalRequest(ps.path); final InternalResponse response = new InternalResponse(); requestProcessor.processRequest(request, response, resolver); -- To stop receiving notification emails like this one, please contact "[email protected]" <[email protected]>.
