You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by kw...@apache.org on 2015/11/16 12:46:23 UTC
svn commit: r1714561 - in /qpid/java/trunk/broker-plugins:
management-http/src/main/java/org/apache/qpid/server/management/plugin/filter/
management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/
management-jmx/src/main/java/...
Author: kwall
Date: Mon Nov 16 11:46:23 2015
New Revision: 1714561
URL: http://svn.apache.org/viewvc?rev=1714561&view=rev
Log:
QPID-6831: [Java Broker] Log CSRE consistently, at INFO level only, across the IO, HTTP, JMX control paths
Modified:
qpid/java/trunk/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/filter/ExceptionHandlingFilter.java
qpid/java/trunk/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/AbstractServlet.java
qpid/java/trunk/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/MBeanInvocationHandlerImpl.java
Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/filter/ExceptionHandlingFilter.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/filter/ExceptionHandlingFilter.java?rev=1714561&r1=1714560&r2=1714561&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/filter/ExceptionHandlingFilter.java (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/filter/ExceptionHandlingFilter.java Mon Nov 16 11:46:23 2015
@@ -32,6 +32,7 @@ import javax.servlet.http.HttpServletReq
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.apache.qpid.server.util.ConnectionScopedRuntimeException;
import org.apache.qpid.server.util.ServerScopedRuntimeException;
public class ExceptionHandlingFilter implements Filter
@@ -53,6 +54,7 @@ public class ExceptionHandlingFilter imp
@Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException
{
+ final String requestURI = ((HttpServletRequest) servletRequest).getRequestURI();
try
{
filterChain.doFilter(servletRequest, servletResponse);
@@ -67,12 +69,24 @@ public class ExceptionHandlingFilter imp
}
catch (IOException | ServletException e)
{
- LOGGER.debug("Exception in servlet '{}': ", ((HttpServletRequest)servletRequest).getRequestURI(), e);
+ LOGGER.debug("Exception in servlet '{}': ", requestURI, e);
+ throw e;
+ }
+ catch (ConnectionScopedRuntimeException e)
+ {
+ if (LOGGER.isDebugEnabled())
+ {
+ LOGGER.debug("Exception in servlet '{}':", requestURI, e);
+ }
+ else
+ {
+ LOGGER.info("Exception in servlet '{}' : {}", requestURI, e.getMessage());
+ }
throw e;
}
catch (RuntimeException e)
{
- LOGGER.error("Unexpected exception in servlet '{}': ", ((HttpServletRequest)servletRequest).getRequestURI(), e);
+ LOGGER.error("Unexpected exception in servlet '{}': ", requestURI, e);
throw e;
}
}
Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/AbstractServlet.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/AbstractServlet.java?rev=1714561&r1=1714560&r2=1714561&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/AbstractServlet.java (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/AbstractServlet.java Mon Nov 16 11:46:23 2015
@@ -216,7 +216,6 @@ public abstract class AbstractServlet ex
}
catch(RuntimeException e)
{
- LOGGER.error("Unable to perform action", e);
throw e;
}
catch (PrivilegedActionException e)
@@ -230,7 +229,6 @@ public abstract class AbstractServlet ex
throw (IOException)cause;
}
- LOGGER.error("Unable to perform action", e);
if(cause instanceof RuntimeException)
{
throw (RuntimeException)cause;
Modified: qpid/java/trunk/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/MBeanInvocationHandlerImpl.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/MBeanInvocationHandlerImpl.java?rev=1714561&r1=1714560&r2=1714561&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/MBeanInvocationHandlerImpl.java (original)
+++ qpid/java/trunk/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/MBeanInvocationHandlerImpl.java Mon Nov 16 11:46:23 2015
@@ -41,6 +41,7 @@ import javax.management.RuntimeMBeanExce
import javax.management.remote.MBeanServerForwarder;
import javax.security.auth.Subject;
+import org.apache.qpid.server.util.ConnectionScopedRuntimeException;
import org.apache.qpid.server.util.ServerScopedRuntimeException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -178,39 +179,39 @@ public class MBeanInvocationHandlerImpl
}
}
- private void handleTargetException(Method method, Object[] args, Throwable targetException)
+ private void handleTargetException(Method method, Object[] args, Throwable originalException)
{
- Throwable error = null;
- if (targetException instanceof RuntimeErrorException)
- {
- error = ((RuntimeErrorException)targetException).getCause();
- }
- else if (targetException instanceof Error)
- {
- error = targetException;
- }
- if (error == null)
- {
- _logger.debug("Exception was thrown on invoking of " + method + " with arguments " + Arrays.toString(args), targetException);
- }
- else
+ Throwable t = originalException;
+ String argsAsString = Arrays.toString(args);
+
+ // Unwrap the underlying from the special javax.management exception types
+ if (originalException instanceof RuntimeErrorException || originalException instanceof RuntimeMBeanException)
{
- _logger.error("Unexpected error occurred on invoking of " + method + " with arguments " + Arrays.toString(args), targetException);
+ t = originalException.getCause();
}
- if (targetException instanceof ServerScopedRuntimeException)
+ if (t instanceof ConnectionScopedRuntimeException)
{
- error = targetException;
+ if (_logger.isDebugEnabled())
+ {
+ _logger.debug("Exception was thrown on invoking of {} with arguments {}",
+ method, argsAsString, t);
+ }
+ else
+ {
+ _logger.info("Exception was thrown on invoking of {} with arguments {} : {}",
+ method, argsAsString, t.getMessage());
+ }
}
- else if (targetException instanceof RuntimeMBeanException)
+ else
{
- // unwrap RuntimeMBeanException
- error = ((RuntimeMBeanException)targetException).getTargetException();
+ _logger.error("Unexpected exception was thrown on invoking of {} with arguments {}",
+ method, argsAsString, t);
}
- if (error instanceof Error || error instanceof ServerScopedRuntimeException)
+ if (t instanceof Error || t instanceof ServerScopedRuntimeException)
{
- _uncaughtExceptionHandler.uncaughtException(Thread.currentThread(), error);
+ _uncaughtExceptionHandler.uncaughtException(Thread.currentThread(), t);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org