NIFI-517:
- Automatically logging stack trace when the exception maps to a 500 response 
code.

Project: http://git-wip-us.apache.org/repos/asf/incubator-nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-nifi/commit/b2a806ab
Tree: http://git-wip-us.apache.org/repos/asf/incubator-nifi/tree/b2a806ab
Diff: http://git-wip-us.apache.org/repos/asf/incubator-nifi/diff/b2a806ab

Branch: refs/heads/NIFI-271
Commit: b2a806ab2ebbe48089acf9612e0ce1630e806ba3
Parents: 58ea7af
Author: Matt Gilman <matt.c.gil...@gmail.com>
Authored: Sat Apr 11 18:49:03 2015 -0400
Committer: Matt Gilman <matt.c.gil...@gmail.com>
Committed: Sat Apr 11 18:49:03 2015 -0400

----------------------------------------------------------------------
 .../nifi/web/api/config/AdministrationExceptionMapper.java     | 6 +-----
 .../org/apache/nifi/web/api/config/ClusterExceptionMapper.java | 6 +-----
 .../java/org/apache/nifi/web/api/config/ThrowableMapper.java   | 3 +--
 3 files changed, 3 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/b2a806ab/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/config/AdministrationExceptionMapper.java
----------------------------------------------------------------------
diff --git 
a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/config/AdministrationExceptionMapper.java
 
b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/config/AdministrationExceptionMapper.java
index ef91254..d631d82 100644
--- 
a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/config/AdministrationExceptionMapper.java
+++ 
b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/config/AdministrationExceptionMapper.java
@@ -35,11 +35,7 @@ public class AdministrationExceptionMapper implements 
ExceptionMapper<Administra
     @Override
     public Response toResponse(AdministrationException exception) {
         // log the error
-        logger.info(String.format("%s. Returning %s response.", exception, 
Response.Status.INTERNAL_SERVER_ERROR));
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(StringUtils.EMPTY, exception);
-        }
+        logger.error(String.format("%s. Returning %s response.", exception, 
Response.Status.INTERNAL_SERVER_ERROR), exception);
 
         // generate the response
         return 
Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(exception.getMessage()).type("text/plain").build();

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/b2a806ab/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/config/ClusterExceptionMapper.java
----------------------------------------------------------------------
diff --git 
a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/config/ClusterExceptionMapper.java
 
b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/config/ClusterExceptionMapper.java
index 19c9704..a3c9884 100644
--- 
a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/config/ClusterExceptionMapper.java
+++ 
b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/config/ClusterExceptionMapper.java
@@ -35,11 +35,7 @@ public class ClusterExceptionMapper implements 
ExceptionMapper<ClusterException>
     @Override
     public Response toResponse(ClusterException exception) {
         // log the error
-        logger.info(String.format("%s. Returning %s response.", exception, 
Response.Status.INTERNAL_SERVER_ERROR));
-
-        if (logger.isDebugEnabled()) {
-            logger.debug(StringUtils.EMPTY, exception);
-        }
+        logger.error(String.format("%s. Returning %s response.", exception, 
Response.Status.INTERNAL_SERVER_ERROR), exception);
 
         return 
Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(exception.getMessage()).type("text/plain").build();
     }

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/b2a806ab/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/config/ThrowableMapper.java
----------------------------------------------------------------------
diff --git 
a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/config/ThrowableMapper.java
 
b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/config/ThrowableMapper.java
index 0ef6edb..7277250 100644
--- 
a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/config/ThrowableMapper.java
+++ 
b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/config/ThrowableMapper.java
@@ -34,8 +34,7 @@ public class ThrowableMapper implements 
ExceptionMapper<Throwable> {
     @Override
     public Response toResponse(Throwable exception) {
         // log the error
-        logger.error(String.format("An unexpected error has occurred: %s. 
Returning %s response.", exception, Response.Status.INTERNAL_SERVER_ERROR));
-        logger.error(StringUtils.EMPTY, exception);
+        logger.error(String.format("An unexpected error has occurred: %s. 
Returning %s response.", exception, Response.Status.INTERNAL_SERVER_ERROR), 
exception);
 
         return 
Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity("An unexpected 
error has occurred. Please check the logs for additional 
details.").type("text/plain").build();
     }

Reply via email to