cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1188908 - /cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/WebApplicationExceptionMapper.java
Date Tue, 25 Oct 2011 21:01:34 GMT
Author: dkulp
Date: Tue Oct 25 21:01:33 2011
New Revision: 1188908

URL: http://svn.apache.org/viewvc?rev=1188908&view=rev
Log:
[CXF-3878] Do some better logging with JAX-RS exceptions

Modified:
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/WebApplicationExceptionMapper.java

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/WebApplicationExceptionMapper.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/WebApplicationExceptionMapper.java?rev=1188908&r1=1188907&r2=1188908&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/WebApplicationExceptionMapper.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/WebApplicationExceptionMapper.java
Tue Oct 25 21:01:33 2011
@@ -30,6 +30,9 @@ import javax.ws.rs.ext.ExceptionMapper;
 
 import org.apache.cxf.common.i18n.BundleUtils;
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.logging.FaultListener;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.phase.PhaseInterceptorChain;
 
 public class WebApplicationExceptionMapper 
     implements ExceptionMapper<WebApplicationException> {
@@ -59,6 +62,19 @@ public class WebApplicationExceptionMapp
             r = Response.status(500).type(MediaType.TEXT_PLAIN).entity(errorMsg.toString()).build();
         }
         
+        
+        Message msg = PhaseInterceptorChain.getCurrentMessage();
+        FaultListener flogger = null;
+        if (msg != null) {
+            flogger = (FaultListener)PhaseInterceptorChain.getCurrentMessage()
+                .getContextualProperty(FaultListener.class.getName());
+        }
+        if (flogger != null) {
+            flogger.faultOccurred(ex, message, msg);
+        } else if (LOG.isLoggable(Level.FINE)) {
+            LOG.log(Level.FINE, message, ex);
+        }
+        
         if (printStackTrace) {
             ex.printStackTrace();
         }



Mime
View raw message