Exception Logging to Email Sink
March 31st, 2005
Send an email when an exception is thrown using EntLib is not rocket science.
Here is a screen shot of how the configuration looks like
The steps involved are:
- Create an Exception Handling App Block
- Create a New Policy (for instance “Email Policy“)
- Create a new type of Exception to manage on the policy. Using “Exception“ will catch every kind of exception thrown
- Create a new Logging Handler for the Exception. Here the Logging and Instrumentation App Block will be added to the config.
- Add the Email Sink on the Logging Block and configure it (from and to email address, etc).
- Create a new Category (for instance “Several“) and add a new Destination
- Configure the Destintation to use the Text Formatter and the Email Sink
- Go to the Logging Handler node and set the LogCategory to “Several“
Here are the config files ExceptionLoggingToEmail.zip (2.91 KB)
Btw, sending an email is a task that requires some resources so
maybe It would be better to use the Async Logging as I described in the
last post. And let the distributor service to send the exception email in another process or server.
Leave a Reply