Generate own Guid for HandlingInstanceId

Topics: Exception Handling Application Block, Logging Application Block
Nov 10, 2010 at 9:42 PM

Long story short - this is Server/Client Exception Handling & Logging using Silverlight.

On the Server:  I catch the exception - convert it to a WCF Fault using Shielding & return the Guid to the client for display -- works great.
On the Client:  However - when a Client Exception is caught, I want to generate a Guid & use that Guid as the HandlingInstanceId to be logged in the database -- instead of passing the Exception across to the Server to be logged & then returning the HandlingInstanceId back.  (If we cannot connect to the server then we want to put this Id & the exception details into ISOStorage).

Is it possible to do this?

Thank you,

Nov 11, 2010 at 12:30 AM

The logic of including the handling instance id in the log's message is in the logging exception handler's exception formatter.  To avoid this, you can create your own custom formatter whose code will be basically just the same as one of the existing exception formatters like the TextExceptionFormatter.  You can then pass the handling instance id you want to use by adding it in the .Data property of the exception you want to handle.  That exception will eventually be passed in your custom formatter through its constructor. 

 

Sarah Urmeneta
Global Technologies & Solutions
Avanade, Inc.
entlib.support@avanade.com