logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hsalim <hsa...@msn.com>
Subject RE: Excluding stack trace from Layout
Date Wed, 30 Jul 2008 16:55:03 GMT

Yann,
Thanks for the reply.
I guess I could do

catch (Exception ex)
{
if (log.IsWarnEnabled)
 log.Warn(string.Format("Error blah {0}:{1}\n{2}\n{3}", key1, key2,
ex.Message, ex.InnerException));				
}

Instead, I would prefer to pass in the exception 
log.Warn(string.Format("error blah {0}:{1}", key1,key2 ), ex);

I want to use an exception layout to selectively log parts of the exception.
I'll use a text file appender to log the stack trace and every gory detail
and use an SMTP appender to semd me just the exception message and
InnerException.  And I can change what gets logged at any time.

I see from the SDK that there is an exception layout but I just cant figure
out what I need to do.

regards
Habib

-- 
View this message in context: http://www.nabble.com/Excluding-stack-trace-from-Layout-tp18734170p18737810.html
Sent from the Log4net - Users mailing list archive at Nabble.com.


Mime
View raw message