5 Replies Latest reply on Feb 14, 2007 3:55 PM by Thomas Diesler

    Suppressing SoapFault Stack trace

    Sidney Zurch Novice

      It looks like this code in SOAPFaultExceptionHandler (1.0.4.GA) will always log an ugly stack trace for Exceptions thrown by the Endpoint.

      Is there some way to supress the stack trace?

      In many cases, the Exception is expected, and all we're really interested in logging at the Endpoint is the fault message.

       /** Translate the request exception into a SOAPFault message.
       */
       public static SOAPMessage exceptionToFaultMessage(Exception reqEx)
       {
       // Get or create the SOAPFaultException
       SOAPFaultException faultEx;
       if (reqEx instanceof SOAPFaultException)
       {
       faultEx = (SOAPFaultException)reqEx;
       }
       else
       {
       QName faultCode = Constants.SOAP11_FAULT_CODE_CLIENT;
       String faultString = (reqEx.getMessage() != null ? reqEx.getMessage() : reqEx.toString());
       faultEx = new SOAPFaultException(faultCode, faultString, null, null);
       faultEx.initCause(reqEx);
       }
       
       Throwable faultCause = faultEx.getCause();
       log.error("SOAP request exception", faultCause != null ? faultCause : faultEx);
      
       ...
       }