Share via


Walkthrough: Populating a Log Message with Additional Context Information

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.

This walkthrough demonstrates the steps to populate a LogEntry object with additional information. The Logging Application Block includes classes that populate a hash table with a specific type of information. This walkthrough demonstrates use of the ManagedSecurityContextInformationProvider class.

To reproduce the demonstration

  1. Create a hash table object that will contain the information.
  2. Create a new ManagedSecurityContextInformationProvider object. Call the PopulateDictionary method of this object, passing the Dictionary to it.
  3. Add custom properties to the Dictionary. The following code adds the property named Screen resolution.
  4. Call the Write method of the Logger class and specify properties to send to the Logging Application Block. The application block will create a log entry containing the extra information.