5 Replies Latest reply on Feb 14, 2007 3:55 PM by thomas.diesler

    Suppressing SoapFault Stack trace

    zurchman

      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);
      
       ...
       }
      
      


        • 1. Re: Suppressing SoapFault Stack trace
          thomas.diesler

          AFAIK, the log is required by the spec

          • 2. Re: Suppressing SoapFault Stack trace
            zurchman

             

            AFAIK, the log is required by the spec

            Which spec would that be?

            I don't see any references to Fault logging in JSR-109 1.2.

            Also, I did some quick scans and did not turn up any references to logging in the SAAJ 1.3, JAX-RPC 1.1, or JAX-WS 2.0 specs.




            • 3. Re: Suppressing SoapFault Stack trace
              elcapitan

              I'm also curious to know how to stop the logging of the stack trace, or if possible, suppress even the logging of the error message.

              It seems reasonable that if the webservice is throwing an exception over the wire, to be interpreted by the client, that the (ugly and scarifying) stack trace shouldn't burl up on the AS. After all, exceptions are all about handling expected problems, and if done right shouldn't cause an interruption in program flow. Stack traces always make me feel uneasy about continuing running an application... :)

              • 4. Re: Suppressing SoapFault Stack trace
                cdreyer1

                I agree. It is very disturbing to have stack traces in the JBoss AS console. In this case the exceptions are perfectly valid.

                Thomas Diesler, what about some way of turning this 'feature' off?

                • 5. Re: Suppressing SoapFault Stack trace
                  thomas.diesler

                  If you turn it off, how will you now that there is a problem in the endpoint? Exception logging is required by the j2ee spec.

                  If it bothers you too much maybe you like to contribute a patch to externalize exception handling.