Author: dkulp Date: Wed Oct 26 16:15:24 2011 New Revision: 1189288 URL: http://svn.apache.org/viewvc?rev=1189288&view=rev Log: Merged revisions 1188911 via svnmerge from https://svn.us.apache.org/repos/asf/cxf/branches/2.4.x-fixes
................ r1188911 | dkulp | 2011-10-25 17:05:50 -0400 (Tue, 25 Oct 2011) | 9 lines 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.3.x-fixes/ (props changed) cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/WebApplicationExceptionMapper.java Propchange: cxf/branches/2.3.x-fixes/ ------------------------------------------------------------------------------ Binary property 'svnmerge-integrated' - no diff available. Modified: cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/WebApplicationExceptionMapper.java URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/WebApplicationExceptionMapper.java?rev=1189288&r1=1189287&r2=1189288&view=diff ============================================================================== --- cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/WebApplicationExceptionMapper.java (original) +++ cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/WebApplicationExceptionMapper.java Wed Oct 26 16:15:24 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(); }
