What Is the Logging and Instrumentation Application Block?


The Logging and Instrumentation Application Block provides a standard and consistent way to log messages. It is designed to make it easy for developers to incorporate logging and tracing functionality into an application. By allowing the destination for log messages to be determined through configuration instead of code, the Logging and Instrumentation Application Block allows an application to be completely decoupled from any particular logging store (e.g., e-mail, files, databases, etc.). Furthermore, configuration data can drive characteristics like the format for the log messages, which messages should be filtered out of a log, and even whether the distribution strategy for a log message should be synchronous or asynchronous.

The primary goal of the Logging and Instrumentation Application Block is to allow a developer to focus on when and why a message should get logged and to allow an administrator to determine how, where, and if the message gets logged. By removing the complexities that surround dynamically routing, formatting, and filtering logs in an application and making it a "no brainer," it is more likely that logging will be considered when designing an application instead of as an afterthought. Furthermore, just like the Exception Handling Application Block (discussed in Chapter 5), even after an application has been deployed and changes occur as to how and where messages should be logged, these changes can be handled through modifications to configuration settings and without the need to modify any code in the application.

Relationship to the Previous Version of the Logging Application Block and the EIF

Microsoft released the Enterprise Instrumentation Framework (EIF) in April 2003. The Enterprise Instrumentation Framework focused on logging and instrumentation tasks in an application. It supported raising and logging events to the WMI, the Windows event log, and a trace log.

Later that same year, Microsoft provided an extension to the Enterprise Instrumentation Framework with the Logging Application Block. The Logging Application Block added such features as Formatters, more Logging Sinks, centralized logging, asynchronous logging, configurable log levels, and a custom Publisher for the Exception Management Application Block. There's a complete document [1] produced by the Microsoft patterns & practices team that is dedicated to the design and development features for that version of the Logging Application Block, so this book won't go into great detail on those specific features. Besides, many of the features that were in the previous version still exist in some way in Enterprise Library's version, so they will be covered later in this chapter. It is important, however, to acknowledge the previous version of the Logging Application Block and the Enterprise Instrumentation Framework as the rightful ancestors to the Logging and Instrumentation Application Block that ships with Enterprise Library.

[1] The document is included as part of the package when you download the block from microsoft.com/downloads/details.aspx?FamilyID=24f61845-e56c-42d6-bbd5-29f0d5cd7f65&DisplayLang=en.

It seems that the process of natural selection doesn't apply only to organic creatures. To make it more useful, new features like templates, a flat file Sink, and an e-mail Sink have been introduced with the Enterprise Library version of the Logging and Instrumentation Application Block. Vestigial or overly complex techniques and constructs have been eliminated. One of these is the integration with the Enterprise Instrumentation Framework. Many developers who used the previous version of this application block felt that the Enterprise Instrumentation Framework was overly complex. It was too hard to configure and use. In the Enterprise Library version of the Logging and Instrumentation Application Block, the dependency on the Enterprise Instrumentation Framework has been completely removed; however, the features have not. Thus, you can think of the Enterprise Library Logging and Instrumentation Application Block as the successor to the Enterprise Instrumentation Framework and the Logging Application Block.




Fenster Effective Use of Microsoft Enterprise Library(c) Building Blocks for Creating Enterprise Applications and Services 2006
Effective Use of Microsoft Enterprise Library: Building Blocks for Creating Enterprise Applications and Services
ISBN: 0321334213
EAN: 2147483647
Year: 2004
Pages: 103
Authors: Len Fenster

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net