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 2009/11/16 23:03:40 UTC

svn commit: r880990 - /cxf/trunk/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java

Author: dkulp
Date: Mon Nov 16 22:03:40 2009
New Revision: 880990

URL: http://svn.apache.org/viewvc?rev=880990&view=rev
Log:
[CXF-2538] Add more info to the logged messages
Modified patch from Cyrille Le Clerc applied

Modified:
    cxf/trunk/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java?rev=880990&r1=880989&r2=880990&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java Mon Nov 16 22:03:40 2009
@@ -35,8 +35,11 @@
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.interceptor.Interceptor;
 import org.apache.cxf.interceptor.InterceptorChain;
+import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.FaultMode;
 import org.apache.cxf.message.Message;
+import org.apache.cxf.service.Service;
+import org.apache.cxf.service.model.OperationInfo;
 import org.apache.cxf.transport.MessageObserver;
 
 /**
@@ -247,11 +250,27 @@
      
                         faultOccurred = true;
                                             
+                        StringBuilder description = new StringBuilder();
+                        if (message.getExchange() != null) {
+                            Exchange exchange = message.getExchange();
+                            Service service = exchange.get(Service.class);
+                            if (service != null) {
+                                description.append('\'');
+                                description.append(service.getName());
+                                OperationInfo opInfo = exchange.get(OperationInfo.class);
+                                if (opInfo != null) {
+                                    description.append("#").append(opInfo.getName());
+                                }
+                                description.append("\' ");
+                            }
+                        }
+                        
                         FaultMode mode = message.get(FaultMode.class);
                         if (mode == FaultMode.CHECKED_APPLICATION_FAULT) {
                             if (LOG.isLoggable(Level.FINE)) { 
                                 LogUtils.log(LOG, Level.FINE,
-                                             "Application has thrown exception, unwinding now", ex);
+                                             "Application " + description
+                                             + "has thrown exception, unwinding now", ex);
                             } else if (LOG.isLoggable(Level.INFO)) {
                                 Throwable t = ex;
                                 if (ex instanceof Fault
@@ -260,17 +279,20 @@
                                 }                            
                                 
                                 LogUtils.log(LOG, Level.INFO,
-                                             "Application has thrown exception, unwinding now: "
+                                             "Application " + description
+                                             + "has thrown exception, unwinding now: "
                                              + t.getClass().getName() 
                                              + ": " + ex.getMessage());
                             }
                         } else if (LOG.isLoggable(Level.WARNING)) {
                             if (mode == FaultMode.UNCHECKED_APPLICATION_FAULT) {
                                 LogUtils.log(LOG, Level.WARNING,
-                                             "Application has thrown exception, unwinding now", ex);
+                                             "Application " + description
+                                             + "has thrown exception, unwinding now", ex);
                             } else {
                                 LogUtils.log(LOG, Level.WARNING,
-                                             "Interceptor has thrown exception, unwinding now", ex);
+                                             "Interceptor for " + description
+                                             + "has thrown exception, unwinding now", ex);
                             }
                         }