Wednesday, May 13, 2009

Excluding the Exception stack trace from the log4net Layout

The blog post Producing readable log4net output has some good ideas for excluding the Exception StackTrace from LoggingEvents.

In my case I used loggingEvent.GetLoggingEventData(FixFlags.All) to get a copy of the LoggingEventData. I then cleared the ExceptionString in the LoggingEventData and used this to create a new LoggingEvent for use in RenderLoggingEvent.