1MDC(3)                User Contributed Perl Documentation               MDC(3)
2
3
4

NAME

6       Log::Log4perl::MDC - Mapped Diagnostic Context
7

DESCRIPTION

9       Log::Log4perl allows loggers to maintain global thread-specific data,
10       called the Nested Diagnostic Context (NDC) and Mapped Diagnostic Con‐
11       text (MDC).
12
13       The MDC is a simple thread-specific hash table, in which the applica‐
14       tion can stuff values under certain keys and retrieve them later via
15       the "%X{key}" placeholder in "Log::Log4perl::Layout::PatternLayout"s.
16
17       Log::Log4perl::MDC->put($key, $value);
18           Store a value $value under key $key in the map.
19
20       my $value = Log::Log4perl::MDC->get($key);
21           Retrieve the content of the map under the specified key.  Typically
22           done by %X{key} in "Log::Log4perl::Layout::PatternLayout".  If no
23           value exists to the given key, "undef" is returned.
24
25       my $text = Log::Log4perl::MDC->remove();
26           Delete all entries from the map.
27
28       Log::Log4perl::MDC->get_context();
29           Returns a reference to the hash table.
30
31       Please note that all of the methods above are class methods, there's no
32       instances of this class. Since the thread model in perl 5.8.0 is "no
33       shared data unless explicetly requested" the data structures used are
34       just global (and therefore thread-specific).
35

AUTHOR

37       Mike Schilli, <log4perl@perlmeister.com>
38
39
40
41perl v5.8.8                       2002-07-10                            MDC(3)
Impressum