You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@logging.apache.org by MC Moisei <mc...@comcast.net> on 2006/06/02 04:41:12 UTC

Log4J Question

Hi,

Why  error(Object,Throwable) show the stack and error(Throwable) doesn't ?

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
...
class EmailVerificationAction
{

        private final static Log logger = LogFactory.getLog(
EmailVerificationAction.class );

        try
        {
            EmailService service = ( EmailService )
ServiceLocator.getService( "emailService" );
            sent = service.sendMessage( null, to, subject, text, html,
null );
        }
       
        catch ( Exception e )
        {
            logger.error( "Some Error", e );//shows stack trace
            logger.error( e );//doesn't show trace
        }
}