You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Javier Gonzalez <ja...@gmail.com> on 2005/06/28 22:30:43 UTC

Logging the exception message but not the stack trace?

Is there a way to configure an appender to log the Exception message
but not the stack trace? To get something like:

ERROR: javax.xml.rpc.JAXRPCException: java.net.MalformedURLException

instead of:

ERROR: javax.xml.rpc.JAXRPCException: java.net.MalformedURLException
    at org.apache.axis.client.Call.setTargetEndpointAddress(Call.java:803)
    at com.atichile.commons.sms.SMSGatewayInterface.injectMessage(SMSGatewayInterface.java:97)
    at com.atichile.commons.sms.GatewaySMSSender.send(GatewaySMSSender.java:199)
    at com.atichile.commons.sms.GatewaySMSSender.send(GatewaySMSSender.java:223)
    at com.atichile.commons.demo.thread.DemoSMSProcessingThread.run(DemoSMSProcessingThread.java:76)
    at java.lang.Thread.run(Thread.java:534)
(etc, etc, etc)

Changing the source code from:

catch(Exception e){
logger.error("My error message",e);
}

to:

catch(Exception e){
logger.error("My error message: "+e.getMessage());
}

is not an option :)

any insight is welcome.

-- 
Javier Gonzalez Nicolini

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org