avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anton Tagunov <atagu...@mail.cnt.ru>
Subject [RT] Minimizing stack traces on startup. Iteration II
Date Fri, 13 Jun 2003 07:55:41 GMT
Hi, All!

The idea to have a list of exceptions for which
we do not need a stack trace looks quite reasonable
to me.

In fact the list could be something like
    ConfigurationException
    ServiceException
    ContextException

How, this functionality - legging or not logging
the stack traces can be located in one of the 3 places:

1) in user code

   for instance

   a)
   
   try{ cm = new ContainerManager( config ); cm.initialize() }
   catch( ConfigurationException ce ){ log only getMessage(); }
   catch( ServiceException se ){ log only getMessage(); }
   catch( ContextException ce ){ log only getMessage(); }
   catch( Throwable t ){ log the full stack trace }

   b)

   class CustomLogFormatter implements xxxFailureHandler
   {
        ...handlexxx...( Throwable t )
        {
            if ( t instanceof ConfigurationException ||
                    t instanceof ServiceException ||
                    t instanceof CotnextException )
            {
                log only getMessage()
            }
            else
            {
                log the full stack trace
            }
        }
   }

   fortressConfig.setXxxxFailureHandler( new CustomLogFormatter() );
   
   
2) in LoggerManager

       lm = new StackTraceSupressingLoggerManagerDecorator(
               new LogKitLoggerManager(...),
               new Class[]{
                       ConfigurationException.class,
                       ServiceException.class,
                       ContextException.class
               } );
       fortressConfig.setLoggerManager( lm );

   and this decorator would wrap any Logger returned
   from the wrapped LoggerManager with a
   
       StackTraseSuppressingLogger( Logger, Class[] )

   that would do the filtering
   
3) in logging backend

   imagine we create a new LogKit formatter with
   the following configuration

   <formatter>
    ..%{message}...
    <no-stack>
        ConfigurationException
        ServiceException
        ContextException
    </no-stack>

------------------

So, where should we put it?
3) looks the nicest to me, but then what to do
   about Log4J logging backend?

- Anton


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org


Mime
View raw message