ELMAH vs Enterprise Library Logging Application Block – a brief comparison

I couldn’t find one single resource where I could easily compare ELMAH with the Enterprise Library Logging application block. Instead, the various features, benefits and design of these two logging frameworks are spread across multiple websites. Hence, I have collated information from these disparate sources hoping that it would bring about a succinct yet meaningful comparison between the two.

Enterprise Library Logging Application Block

The Enterprise Library Logging Application Block simplifies the implementation of common logging functions. You can use the Logging Application Block to write information to a variety of locations:

  • The event log
  • An e-mail message
  • A database
  • A message queue
  • A text file
  • A Windows® Management Instrumentation (WMI) event
  • Custom locations using application block extension points

Features

  • Multiple targets can be configured
  • Enterprise Library Configuration Console available for easy configuration
  • Large number of options to be configured may make it a bit daunting to start with
  • Invasive – requires code change to implement logging
  • Logs all kinds of events/information, not just for error logging
  • Formatters available for formatting the event message
  • Log filters allow filtering of log messages
  • Facilities for WCF integration

 

Comparison with ELMAH

Feature/s Logging Application Block
ELMAH
Scope
  • True enterprise level exception handling framework, across layers, tiers, processes and services (in tandem with Exception Handling Application Block)
  • Logs all kinds of events, not just exceptions
  • Lightweight logging framework with extension points for ASP.NET web applications
  • By default logs unhandled exceptions
  • Error signaling allows handled exceptions to be logged
  • No support for non-error messages
Targets supported
  • The event log
  • An e-mail message
  • A database (supports multiple)
  • A message queue
  • A text file
  • A Windows® Management Instrumentation (WMI) event
  • Custom locations using application block extension points
  • Microsoft SQL Server
  • Oracle (OracleErrorLog)
  • SQLite (version 3) database file
  • Microsoft Access (AccessErrorLog)
  • Loose XML files
  • RAM (in-memory)
  • SQL Server Compact Edition
  • MySQL
  • PostgreSQL
Pluggable? No. Requires careful configuration and implementation in code Fully pluggable out of the box, requires only configuration for basic features
Configuration
  • XML configuration in the app.config/web.config as applicable
  • Enterprise Library Configuration Console tool available for ease in configuration
XML configuration in the web.config
Intrusiveness Requires code change for implementation No code change required for basic features
Extensibility
  • Easily extensible with multiple points for extensibility
  • Easy to extend for log message formatting and contextual information
  • No source code change required
  • Requires change to source code for any kind of extensibility
  • Error message formatting and contextual information addition requires source code changes
Scalability
  • Easily scales for small to medium sized applications
  • Not enough data available for large sized applications
Requires more research

 

Summary

The Logging Application block beats ELMAH hands down in comprehensiveness. It can be used for logging all kinds of messages from all layers of various kinds of applications including ASP.NET, windows forms, WCF services etc. It can also be used for tracing for performance and debugging purposes.

On the other hand ELMAH is a light-weight framework for logging exceptions in ASP.NET applications.

ELMAH is very easy to configure and use. It is fully pluggable. Whereas implementation of the Logging Application block requires careful planning, configuration and is intrusive as it requires changes to code wherever logging is required.

One of the biggest benefits of the Enterprise Library is that it works in tandem with the Exception Handling block to implement a consistent strategy for processing exceptions in all the architectural tiers of an enterprise application including WCF Services.

While ELMAH is perfect for ASP.NET applications, for enterprise applications the Enterprise Library fulfills the comprehensiveness required.

References:-

  1. http://msdn.microsoft.com/en-us/library/ff664569%28v=pandp.50%29.aspx
  2. http://www.codeproject.com/Articles/9545/Get-Logging-with-the-Enterprise-Library
  3. THE ELMAH REPORT
  4. http://msdn.microsoft.com/en-us/library/ff664698%28v=pandp.50%29.aspx
  5. http://stackoverflow.com/questions/766610/how-to-get-elmah-to-work-with-asp-net-mvc-handleerror-attribute/5936867#5936867
  6. http://code.google.com/p/elmah/wiki/DotNetSlackersArticle#Logging
  7. http://mikee.se/Archive.aspx/Details/elmah_on_steroids_20100403