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
11       Context (MDC).
12
13       The MDC is a simple thread-specific hash table, in which the
14       application can stuff values under certain keys and retrieve them later
15       via the "%X{key}" placeholder in
16       "Log::Log4perl::Layout::PatternLayout"s.
17
18       Log::Log4perl::MDC->put($key, $value);
19           Store a value $value under key $key in the map.
20
21       my $value = Log::Log4perl::MDC->get($key);
22           Retrieve the content of the map under the specified key.  Typically
23           done by %X{key} in "Log::Log4perl::Layout::PatternLayout".  If no
24           value exists to the given key, "undef" is returned.
25
26       my $text = Log::Log4perl::MDC->remove();
27           Delete all entries from the map.
28
29       Log::Log4perl::MDC->get_context();
30           Returns a reference to the hash table.
31
32       Please note that all of the methods above are class methods, there's no
33       instances of this class. Since the thread model in perl 5.8.0 is "no
34       shared data unless explicetly requested" the data structures used are
35       just global (and therefore thread-specific).
36
38       Copyright 2002-2009 by Mike Schilli <m@perlmeister.com> and Kevin Goess
39       <cpan@goess.org>.
40
41       This library is free software; you can redistribute it and/or modify it
42       under the same terms as Perl itself.
43
44
45
46perl v5.12.2                      2010-08-31                            MDC(3)
Impressum