## Class LoggerMDC

Description

The LoggerMDC class provides _mapped diagnostic contexts_.

A Mapped Diagnostic Context, or MDC in short, is an instrument for distinguishing interleaved log output from different sources. Log output is typically interleaved when a server handles multiple clients near-simultaneously.

This class is similar to the LoggerNDC class except that it is based on a map instead of a stack.

- version: $Revision: 1343630 $
- since: 0.3

Located in /log4php/LoggerMDC.php (line 36)

Method Summary
static void clear ()
static string get (string $key)
static array getMap ()
static void put (string $key, string $value)
static void remove (string $key)
Methods
static method clear (line 85)

Clears the mapped diagnostic context.

- access: public

static void clear ()
static method get (line 59)

Returns the context value identified by the key parameter.

- return: The context or an empty string if no context found for given key.
- access: public

static string get (string $key)

- string $key: The key.

static method getMap (line 67)

Returns the contex map as an array.

- return: The MDC context map.
- access: public

static array getMap ()
static method put (line 48)

Stores a context value as identified with the key parameter into the context map.

- access: public

static void put (string $key, string $value)

- string $key: the key
- string $value: the value

static method remove (line 78)

Removes the the context identified by the key parameter.

Only affects user mappings, not $_ENV or $_SERVER.

- access: public

static void remove (string $key)

- string $key: The key to be removed.

Documentation generated on Mon, 02 Feb 2026 13:59:51 +0900 by phpDocumentor 1.4.4