Logging within Azure via Linkedin

Recently there was a discussion on Linkedin about logging within Azure.  The discussion brought up the use of Enterprise Library and I wanted to share the response I provided.

Posted on Linked:

The things you are talking about are many of the driving forces behind Unified Logging (http://www.unifiedlogging.com/) and let me explain why.

Yes adding an email notification with Enterprise Library is easy though if thousands of email “events” (could be errors) happen you get thousands of emails.  On top of that to change when an email is sent you have to go touch production to make the change.  Lastly, you may not be the only one who wants to be notified for specific events, say application support wants to be notified when a specific event happens every evening but you do not really care about that.

I’m a firm believer of disconnecting the notification configuration and notifications themselves from the application itself and let people get notified when they want to be notified.

I too use Enterprise Library 5 and since Unified Logging is not a logging framework but rather a bucket for your logging information it comes down to about 10 seconds or work to add the Unified Logging NuGet Package and the one line of configuration in the logging configuration for entlib (http://blog.unifiedlogging.com/getting-started-with-net-nuget-package/).  Don’t forget to add the listener to category sources in the entlib config.   Next setup a notification index (http://blog.unifiedlogging.com/indexes-102-notifications/ ), most likely adding a notification to the “error” index that is created for you will get you started.  Most .NET applications (though there are many connectors for many languages) will just use the trace listener that ships with the NuGet package and leverage the logging framework of their choice.

I would point out that you are not limited to one trace listener as it is a collection. I myself use the event log listener, Azure Diagnostics Listener, Unified Logging Listener, and a couple custom listeners.

It is also worth pointing out that order of listeners for a category source does sometime matter with entlib, if the Event Log listener throws (and it could) the other listeners for the category source will not process so it is best to put that listener last in the category sources.

Comments are closed.