You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2011/10/25 23:05:50 UTC

svn commit: r1188911 - in /cxf/branches/2.4.x-fixes: ./ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/WebApplicationExceptionMapper.java

Author: dkulp
Date: Tue Oct 25 21:05:50 2011
New Revision: 1188911

URL: http://svn.apache.org/viewvc?rev=1188911&view=rev
Log:
Merged revisions 1188908 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1188908 | dkulp | 2011-10-25 17:01:33 -0400 (Tue, 25 Oct 2011) | 1 line
  
  [CXF-3878] Do some better logging with JAX-RS exceptions
........

Modified:
    cxf/branches/2.4.x-fixes/   (props changed)
    cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/WebApplicationExceptionMapper.java

Propchange: cxf/branches/2.4.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/WebApplicationExceptionMapper.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/WebApplicationExceptionMapper.java?rev=1188911&r1=1188910&r2=1188911&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/WebApplicationExceptionMapper.java (original)
+++ cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/WebApplicationExceptionMapper.java Tue Oct 25 21:05:50 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();
         }