Remove HandlingInstanceID from Message created by Exception Handling Block

Topics: Exception Handling Application Block, Logging Application Block
Aug 19, 2010 at 12:42 AM

How can I remove the HandlingInstanceID from the message that gets formatted by the Exception Handling Block and written to a log? Or at least move it so it is not at the beginning of the message. I'd like to see the Exception message at the beginning of the message. When logging to a DB then querying the log all you see is the HandlingInstanceID in the message column. That is not much help.

Aug 19, 2010 at 4:33 AM

One approach I can think of is to use a Custom Exception Formatter (see documentation for details) passing an empty handlingInstanceId in the base class within the constructor.

        public MyExceptionFormatter(TextWriter writer, Exception exception, Guid handlingInstanceId)
            : base(writer, exception, Guid.Empty)
        { }

Hope this helps.

Gino Terrado
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com