Scenarios and Goals

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.

The Logging Application Block addresses the most common tasks that developers face when they write applications that require logging functionality. These tasks are arranged according to scenarios. Each scenario gives an example of a real-world situation, such as populating and raising events from code; discusses the particular requirements of the situation; and shows the code that accomplishes the task.

The goal of arranging these tasks according to scenarios is to provide context for the code. Instead of showing an isolated group of methods, with no sense of where they can best be used, the Logging Application Block uses scenarios to show code usage in situations that are familiar to many developers whose applications must use logging features.

The scenarios are the following:

  • Populating and raising events from code
  • Populating a log message with additional context information
  • Tracing activities and propagating context information
  • Checking filter status before constructing log messages.
  • Configuring options for trace listeners
  • Directing different event types to different trace listeners
  • Configuring log filters
  • Configure logging to be performed from a central location
  • Creating a custom trace listener

For details about each scenario, see Key Scenarios.

When to Use the Logging Application Block

If your applications have a requirement to log information to the event log, e-mail, a database, a message queue, Windows Management Instrumentation (WMI), or a file, you should strongly consider using the Logging Application Block to provide this functionality, particularly if you need to filter logging messages based on category or priority, if you need to format the messages, or if you need to change the destination of the message without changing the application code. The Logging Application Block is also designed to be extensible, and includes the facility to create custom formatters and trace listeners, which you can adapt to meet your application's logging requirements.

Note

The Logging Application Block formatters do not encrypt logging information. Trace listener destinations receive logging information as clear text. This means that attackers that can access a trace listener destination can read the information. You can prevent unauthorized access to sensitive information. One approach is to use Access Control Lists (ACL) to restrict access to flat files. You can also create a custom formatter that encrypts log information. For information on how to create a custom formatter, see Extending the Logging 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.