MDC Set Method | Apache log4net™ SDK Documentation

Add an entry to the MDC

Namespace: log4net
Assembly: log4net (in log4net.dll) Version: 2.0.8.0-.NET 4.0
Syntax

C#
VB
C++
F#
Copy

    public static void Set(
    	string key,
    	string value
    )

    Public Shared Sub Set (
    	key As String,
    	value As String
    )

    public:
    static void Set(
    	String^ key,
    	String^ value
    )

    static member Set :
            key : string *
            value : string -> unit

#### Parameters

key
  Type: System
  String
  The key to store the value under.
value
  Type: System
  String
  The value to store.

Remarks

Note
The MDC is deprecated and has been replaced by the Properties. The current MDC implementation forwards to the ThreadContext.Properties.

Puts a context value (the value parameter) as identified with the key parameter into the current thread's context map.

If a value is already defined for the key specified then the value will be replaced. If the value is specified as null then the key value mapping will be removed.

See Also

#### Reference

MDC Class
log4net Namespace