Hello Leif!

LM> The stack traces are obviously invaluable during development and even
LM> for debugging problems in a deployed application.
LM> But they also need to be invisible to the end users.

LM> I usually do this on a component level by only showing stack traces at the
LM> debug priority.

Very interesting!

What I do, I have a number of expected exceptions that I know
I won't need a stack trace for (f.e. ConfigurationException)
and do it like this

        try{
            FortressConfig fortressConfig = ...;
            DefaultContainerManager containerManager = ...;
            containerManager.initialize();
            return (Foo) containerManager.getContainer();
        }
        catch( Fatal f )
        {
            /**
             * This is the exception that is thrown if error
             * has alredy been logged
             */
            return null;
        }
        /**
         * Now we'll enumerate the exceptions for which we want
         * only the message and no stack trace.
         */
        catch( ConfigurationException ce )
        {
            /* this in effect is just
             * m_logger.log( message )
             */
            fatal( ce.getMessage() );
            return null;
        }
        catch( LinkageError le )
        {
            fatal( le.toString() );
            return null;
        }
        catch( Throwable t )
        {
            /**
             * We did not expect this error - we need a stack trace.
             */
            fatal( "Initialization failed", t );
            return null;
        }

Which approach is more powerfull?

LM> Would that be an option worth considering for the
LM> container as well?

I know you've been asking Berin, but you have also
given me some thinking food.. Don't know ATM.

- Anton


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to