configuring output of exception handling block

Topics: Exception Handling Application Block
May 13, 2009 at 7:48 PM


I am using the exception handling application block from enterprise library 2.0. Is there any documentation that describes exactly what error information is recorded by this block?

Also is there any way to configure the error information that is logged. For example I don't think the application block records the error code of an exception but I would like it to.

many thanks

May 14, 2009 at 5:05 AM

Well, the template of the TraceListener you used for logging will tell you what information is being logged.  If you need additional information to be logged, you can add them to the Data collection property of the exception and it will automatically be included in the Extended properties information.


Sarah Urmeneta
Global Technology & Solutions
Avanade, Inc.

May 14, 2009 at 6:42 PM


Thanks very much for your reply. So I need to find out more about writing templates for the Text Formatter? Any good links are much appreciated. Naturally I will search google myself but you have to wade through so much junk to find good links so any pointers would be appreciated


May 14, 2009 at 8:39 PM


I've just looked into this based on what you said and I'm confused.  The trace listener I am using has a TextFormatter which uses the following template:

Timestamp: {timestamp}
Message: {message}
Category: {category}
Priority: {priority}
EventId: {eventid}
Severity: {severity}
Machine: {machine}
Application Domain: {appDomain}
Process Id: {processId}
Process Name: {processName}
Win32 Thread Id: {win32ThreadId}
Thread Name: {threadName}
Extended Properties: {dictionary({key} - {value}

Information about an exception is listed in the Message part of the output. It looks to me as though the information displayed about an exception is hard coded in the TextExceptionFormatter class. Is this correct? You said if I added any extra information I wanted to the Data colleciton property of an exception it would automatically be added to the Extended Properties at the end of the template. I would like to display the status of some variables at the time of certain errors. Some of the variables are quite long. Is using the Data colleciton property of an exception still a good solution given this information?

Many thanks

May 15, 2009 at 8:33 AM

Do you mean the information about the Exception? and not the Log which uses the said template. I think I'll agree with that. What do you mean by variables are quite long?

Valiant Dudan
Global Technology & Solutions
Avanade, Inc.


May 21, 2009 at 12:46 PM


When i get an error i would like to record the input that created an error in my program. For me the input looks like this:

192: #ID,352884006822283,ALARM,0x010,IOP,O,0x00,I,0x10,GPSEX,V,D,,T,000027,La,51.52542,N,Lo,0.10666,E,V,0.0

I suppose that isn't too long really to put in the Data collection property?

May 22, 2009 at 3:29 AM

No, it would still appear as it is in your tracelistener's log.


Sarah Urmeneta
Global Technology & Solutions
Avanade, Inc.


Jul 6, 2009 at 10:18 PM
Edited Jul 6, 2009 at 11:45 PM