ContextItems.SetContextItem Method
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. |
Adds a key/value pair to a dictionary in the CallContext. Each context item is recorded with every log entry.
Namespace: Microsoft.Practices.EnterpriseLibrary.Logging
Assembly: Microsoft.Practices.EnterpriseLibrary.Logging (in Microsoft.Practices.EnterpriseLibrary.Logging.dll)
Syntax
'Declaration
<SecurityPermissionAttribute(SecurityAction.LinkDemand, Flags := SecurityPermissionFlag.Infrastructure)> _
PublicSubSetContextItem ( _
keyAs Object, _
valueAs Object _
)
[SecurityPermissionAttribute(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure)]
publicvoidSetContextItem(
Object key,
Object value
)
[SecurityPermissionAttribute(SecurityAction::LinkDemand, Flags = SecurityPermissionFlag::Infrastructure)]
public:
voidSetContextItem(
Object^ key,
Object^ value
)
publicfunctionSetContextItem(
key : Object,
value : Object
)
Parameters
- key
Type: System.Object
Hashtable key.
- value
Type: System.Object
Value of the context item. Byte arrays will be base64 encoded.
Examples
The following example demonstrates use of the AddContextItem method.
Logger.SetContextItem("SessionID", myComponent.SessionId);
See Also
Microsoft.Practices.EnterpriseLibrary.Logging Namespace
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. |