You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Anton Tagunov <at...@mail.cnt.ru> on 2003/06/12 05:44:29 UTC
Re[2]: [Fortress] Minimizing stack traces on startup.
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: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org
Re: [Fortress] Minimizing stack traces on startup.
Posted by Peter Royal <pr...@apache.org>.
On Thursday, June 12, 2003, at 12:29 AM, Leif Mortenson wrote:
> Rather than this:
> getLogger().error( msg, e );
>
> I do this:
> getLogger().error( msg + " : " + e.getMessage() );
> getLogger().debug( "Stack Trace:", e );
>
> Or something along those lines. It really depends on the context.
You've found that that approach works better than having a "user" log
that doesn't include stack-traces in the formatter and a "dev" log that
does?
-pete
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org
Re: [Fortress] Minimizing stack traces on startup.
Posted by Leif Mortenson <le...@tanukisoftware.com>.
Rather than this:
getLogger().error( msg, e );
I do this:
getLogger().error( msg + " : " + e.getMessage() );
getLogger().debug( "Stack Trace:", e );
Or something along those lines. It really depends on the context.
Cheers,
Leif
Anton Tagunov wrote:
>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
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org