Logging and Instrumentation Application Block

 

Retired Content

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

The latest Enterprise Library information can be found at the Enterprise Library site.

Logging and Instrumentation Application Block

patterns & practices Developer Center

Enterprise Library for .NET Framework 1.1

patterns & practices Developer Center

Microsoft Corporation

June 2005

Summary

This page provides an overview of the Enterprise Library Logging and Instrumentation Application Block. This is reusable and extensible source code-based guidance that simplifies development of common logging and instrumentation functionality in .NET-based applications.

Downloads
License
Hands-On Labs
Webcasts
Community

* Important Note: The January 2005 release of Enterprise Library is no longer available to download, due to important issues discovered after the release. Customers building new applications should move to the June 2005 release. Customers who have already adopted the January release must apply the patches available on Enterprise Library Community site. Please direct any questions to the community site or to devfdbck@microsoft.com

Contents

Introduction to the Logging and Instrumentation Application Block
Design of the Logging and Instrumentation Application Block
Test Drive
Feedback and Support
June 2005 Release Updates
Roadmap
Authors and Contributors
Related Titles

Introduction to the Logging and Instrumentation Application Block

The Enterprise Library Logging and Instrumentation Application Block lets developers incorporate standard logging and instrumentation functionality in their applications. Applications can use the Logging and Instrumentation Block to log events to a variety of locations:

  • The event log
  • E-mail messages
  • A database
  • A message queue
  • A file
  • WMI

The Logging and Instrumentation Application Block helps with application development in a number of ways:

  • It helps maintain consistent logging and instrumentation practices, both within an application and across the enterprise.
  • It eases the learning curve for developers by using a consistent architectural model.
  • It provides implementations that you can use to solve common application logging and instrumentation problems.
  • It is extensible, supporting custom implementations of formatters and event sinks.

Common Scenarios

Developers frequently write applications that require logging and instrumentation functionality. Typically, these applications must format events appropriately and log events, either locally or over the network. In some cases, you may have to collate events from multiple sources onto a single computer.

The Logging and Instrumentation Application Block simplifies application development by collecting together many of the most common logging and instrumentation tasks that need to be included in applications. Each task is handled in a consistent manner, abstracting the application code from the specific logging and instrumentation providers. The architectural model lets you change underlying event sinks and formatters through configuration changes, without changing the application code.

Audience Requirements

This application block is intended for software architects and software developers. To benefit fully from this guidance, you should have an understanding of the following technologies:

  • Microsoft Visual C# development tool or Microsoft Visual Basic development system
  • .NET Framework (including an understanding of logging and instrumentation concepts)

Highlights of the Enterprise Library Logging and Instrumentation Application Block

The Logging and Instrumentation Application Block builds on the functionality of two earlier application blocks, the Logging Application Block and the Exception Management Application Block. This version of the Logging and Instrumentation Application Block includes a number of features that are not contained in the earlier application blocks:

  • Logging without the need for the Enterprise Instrumentation Framework (EIF)
  • Support for an e-mail event sink
  • Support for a database event sink, instead of a specific SQL Server event sink
  • Configuring formatters through the Enterprise Library Configuration Console

Migrating from the Logging Application Block

Users of the Logging Application Block should recognize many of the scenarios addressed by the Logging and Instrumentation Application Block. Although the current version builds on the knowledge and feedback gained from earlier versions, it represents a significant change in how those scenarios are addressed.

Key differences between the Enterprise Library version of the Logging and Instrumentation Application Block and the Logging Application Block include the following:

  • It no longer has any dependencies on the Enterprise Instrumentation Framework (EIF).
  • It uses formatters that are defined in the Enterprise Library Configuration Console instead of creating specific XSLT files.
  • It no longer provides a Trace Log event sink.
  • It no longer supports multiple formatters that are chained together. Instead, all the formatting information is contained in a single formatter.
  • It no longer provides an encryption formatter.

System Requirements

To use the Logging and Instrumentation Application Block, you need the following:

  • Microsoft Windows 2000, Windows XP Professional, or Windows Server 2003 operating system
  • Microsoft .NET Framework version 1.1
  • Microsoft Visual Studio .NET 2003 Enterprise Architect, Enterprise Developer, or .NET Professional edition
  • Stores to maintain log messages (exactly what is required depends on the specific event sinks you use)

Logging and Instrumentation Application Block Dependencies

The Enterprise Library application blocks are designed to be used in conjunction with each other. In some cases, the application blocks have dependencies on other application blocks and code included in the Enterprise Library. The Logging and Instrumentation Application Block has dependencies on the following:

  • The Configuration Application Block. The Logging and Instrumentation Application Block uses this to read its configuration information.
  • Common library functionality, such as instrumentation. This provides various functions for exposing events and data that are used for system management.

Depending on the specific functionality you require from the Logging and Instrumentation Application Block, you may also require the Data Access Application Block, which the Logging and Instrumentation Application Block uses for the database event sink.

The application block uses XML files to store configuration information. The recommended way to modify this information is to use the Enterprise Library Configuration Console.

Design of the Logging and Instrumentation Application Block

The Logging and Instrumentation Application Block was designed to achieve the following goals:

  • Make sure that the code to use the application block is clear and straightforward.
  • Provide a simple and intuitive object model.
  • Encapsulate the logic that is used to perform the most common application logging and instrumentation tasks
  • Present a standard consistent model for common logging and instrumentation tasks.
  • Minimize the need for custom logging and instrumentation-related code.
  • Make sure that the application block is easily and highly configurable.
  • Make sure that the application block is extensible.
  • Make sure there is minimal or negligible performance impact compared to manually written logging code that accomplishes the same functionality.

Design Highlights

Figure 1 illustrates the design of the Logging and Instrumentation Application Block.

Ff648417.f01entlib05(en-us,PandP.10).gif

Figure 1. Design of the Logging and Instrumentation Application Block

The Logging and Instrumentation Application Block is designed to externalize all decisions about how to deal with events from a running application. This design lets you change logging behavior without changing the code of the application.

Test Drive

The Logging and Instrumentation Application Block has been developed as a result of analyzing common enterprise development challenges and successful solutions to these challenges. However, because each application is unique, you will not find this application block suitable for every application. To evaluate this application block and determine its applicability to your projects, Microsoft suggests you dedicate at least half of a day to explore the application block. The following is a suggested evaluation approach:

  1. Download Enterprise Library.
  2. Install Enterprise Library and compile all application blocks and tools.
  3. Read the "Introduction" and "Scenarios and Goals" sections of the documentation.
  4. Compile and run the QuickStart samples, and read through the related "QuickStart Walkthroughs" and "Key Scenarios" sections of the documentation.
  5. If the application block looks like a good fit for your application, try implementing a simple use case in your application or in a throw-away prototype application using the application block.

Feedback and Support

Questions? Comments? Suggestions? To provide feedback about this application block, or to get help with any problems, please visit the Enterprise Library Community site. The community site is the preferred feedback and support channel because it allows you to share your ideas, questions, and solutions with the entire community. Alternatively, you can send e-mail directly to the Microsoft patterns & practices team at devfdbck@microsoft.com, although we are unable to respond to every message.

Enterprise Library is a guidance offering, designed to be reused, customized, and extended. It is not a Microsoft product. Code-based guidance is shipped "as is" and without warranties. Customers can obtain support through Microsoft Support Services for a fee, but the code is considered user-written by Microsoft support staff. For more information about our support policy, see the Enterprise Library home page.

June 2005 Release Updates

The June 2005 release of Enterprise Library is a minor update of the original version released in January 2005. Please see About the June 2005 Release for more information on the updates to the application blocks for the June 2005 release.

Roadmap

An updated release of the Logging and Instrumentation Application Block is planned for the next release of Enterprise Library. This release will target the .NET Framework 2.0 and Visual Studio 2005 and will include additional improvements based on customer feedback.

Authors and Contributors

The Enterprise Library Logging and Instrumentation Application Block was produced by the following people:

  • Program Managers: William Loeffler (Microsoft Corporation), Linh Nguyen (Avanade Inc)
  • Product Manager: Tom Hollander (Microsoft Corporation)
  • Architects: Edward Jezierski (Microsoft Corporation), Kyle Huntley (Avanade Inc)
  • Development: Scott Densmore, Peter Provost, Brad Wilson (Microsoft Corporation), Brian Button (Murphy and Associates), Hisham Baz (Avanade Inc), Timothy Shakarian (Avanade Inc)
  • Test: Mohammad Al-Sabt, Carlos Farre (Microsoft Corporation), Mani Krishnaswami, Gokulaprakash Thilagar, Rohit Sharma, Prashant Bansode, Jeevarani Radhakrishnan, Dhananjaya Rao (Infosys Technologies Ltd), Pavan Kumar Sura (Volt)
  • Documentation and Samples: RoAnn Corbisier (Microsoft Corporation), Tim Osborn (Ascentium Corporation), Roberta Leibovitz (Modeled Computation LLC), Paul Slater (Wadeware LLC), Tina Burden McGrayne (Linda Werner & Associates Inc)

Many thanks to the following advisors who provided invaluable assistance:

  • Rudy Araujo, Yen-Ming Chen, Mark Curphey and David Raphael of Foundstone Inc.
  • Benoit Morneau and Shoichi Takasaki of Bowne Global Solutions

Start | Previous | Next

patterns & practices Developer Center

Retired Content

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

The latest Enterprise Library information can be found at the Enterprise Library site.