Exception Management Block

I was sitting at work fixing all the bugs introduced in my code due to a zero-hour overhaul of the database, when my favorite MCS employee shows up (Josh W). So since he's there, I gladly pick his brain on how to setup the Exception Management block to use an application specific event source. I had had problems when I initially set it up, and it was publishing using the default event source.

For those of you unfamiliar with the Exception Management Application Block, it's P&P's swag at standardizing publishing errors in a consistent way throughout your all of your errors/exceptions... For instance, I publish to the event log, and then pass a string back to the user telling them to note the day/time of the error - and to tell me. But eventually I'll create my own publisher that emails me the info - as well as drops into the event log.

NOTE: If you publish your errors to a log other than the Application Log, and you happen to use MOM in your org - your errors won't be collected by MOM without creating a plug-in/snap-in/or whatever.

Turns out that you need to *add a registry key and string* to create the event source. Then point to it with your web.config <exceptionManagement />section (which I had commented out because it didn't work for me... probably because I didn't have the reg-key/string combo as noted above). I'll update this tomorrow from work with the specific reg key/string combo... as well as the whole of the web.config changes.

<configSection>
     <section> name="exceptionManagement" type="Microsoft.ApplicationBlocks.ExceptionManagement.ExceptionManagerHandler,Microsoft.ApplicationBlocks.ExceptionManagement" />
</configSection>

<exceptionManagement mode="on">
     <publisher assembly="Microsoft.ApplicationBlocks.ExceptionManagement" type="Microsoft.ApplicationBlocks.ExceptionManagement.DefaultPublisher" logname="Application" applicationName"My App Name" />
</exceptionManagement>

This code block will give you the settings you need to publish any errors to the Application Event Log with the "My App Name" listed as the event source - but you are not done yet! You have to create the event source:

\HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\EventLog\Application

Add your own key (eg. "My App Name") here, then add a string called "EventMessageFile" to your key with the value of "C:\Windows\Microsoft.NET\Framework\v1.1.4322\EventLogMessages.dll". This entry will create the event source that you referenced in your web.config.

posted @ Tuesday, January 18, 2005 8:09 PM

Print

Comments on this entry:

No comments posted yet.

Your comment:



 (will not be displayed)


 
 
 
 
 

Live Comment Preview:

 
«November»
SunMonTueWedThuFriSat
25262728293031
1234567
891011121314
15161718192021
22232425262728
293012345