Log4gMDC

Log4gMDC — Mapped data context

Synopsis

                    Log4gMDC;
                    Log4gMDCClass;
void                log4g_mdc_put                       (const gchar *key,
                                                         const gchar *value,
                                                         ...);
const gchar *       log4g_mdc_get                       (const gchar *key);
void                log4g_mdc_remove                    (const gchar *key);
const GHashTable *  log4g_mdc_get_context               (void);

Description

The MDC class provides mapped data contexts. A mapped data context (MDC for short) is an instrument for distinguishing interleaved log output from different sources. An example of interleaved log output may occur when a server handles multiple clients simultaneously.

Mapped data context is managed on a per-thread basis. The main difference between Log4g MDCs and Log4j MDCs is that Log4g contexts are not inherited by child threads.

Details

Log4gMDC

typedef struct {
} Log4gMDC;

The Log4gMDC structure does not have any public members.


Log4gMDCClass

typedef struct {
} Log4gMDCClass;

The Log4gMDCClass structure does not have any public members.


log4g_mdc_put ()

void                log4g_mdc_put                       (const gchar *key,
                                                         const gchar *value,
                                                         ...);

Put a context value as identified by a key into the current thread's context map.

If a context map has not been created for the current thread it will be created as a side-effect.

key :

The key to associate with value.

value :

The value to associate with key (accepts printf formats).

... :

Format parameters.

Since 0.1


log4g_mdc_get ()

const gchar *       log4g_mdc_get                       (const gchar *key);

Retrieve a the context value associated with a key from the current thread's context map.

key :

The key to retrieve.

Returns :

The context value associated with key.

Since 0.1


log4g_mdc_remove ()

void                log4g_mdc_remove                    (const gchar *key);

Remove a context value associated with a key from the current thread's context map.

key :

The key to remove.

Since 0.1


log4g_mdc_get_context ()

const GHashTable *  log4g_mdc_get_context               (void);

Retrieve the current thread's MDC as a hash table.

This function is used internally by appenders that log asynchronously.

Returns :

The current MDC context as a hash table.

Since 0.1