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.|
This topic describes common situations developers must address when providing logging functionality in their applications. Each scenario explains the task, describes a real-world situation where such a task might arise, and includes code demonstrating how to use the Logging Application Block to complete the task. The scenarios are as follows:
- Populating and Raising Events from Code. This scenario illustrates how to specify the data to be logged, along with a category and priority, and pass it to the application block.
- Populating a Log Message with Additional Context Information. This scenario illustrates how to populate a dictionary of custom information to be added to a log entry.
- Tracing Activities and Propagating Context Information. This scenario illustrates how to log the start and end of an activity and trace key activity points in between.
- Creating Custom Trace Listeners. This scenario illustrates how to create a custom trace listener for sending logging messages to an alternate location.
- Checking Filter Status before Constructing Log Messages. This scenario illustrates how to avoid collecting log information for messages that will not be logged according to the current configuration information.