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

NAME

6       Log::Log4perl::NDC - Nested Diagnostic Context
7

DESCRIPTION

9       Log::Log4perl allows loggers to maintain global thread-specific data,
10       called the Nested Diagnostic Context (NDC).
11
12       At some point, the application might decide to push a piece of data
13       onto the NDC stack, which other parts of the application might want to
14       reuse. For example, at the beginning of a web request in a server, the
15       application might decide to push the IP address of the client onto the
16       stack to provide it for other loggers down the road without having to
17       pass the data from function to function.
18
19       The Log::Log4perl::Layout::PatternLayout class even provides the handy
20       %x placeholder which is replaced by the blank-separated list of
21       elements currently on the stack.
22
23       This module maintains a simple stack which you can push data on to,
24       query what's on top, pop it off again or delete the entire stack.
25
26       Its purpose is to provide a thread-specific context which all
27       Log::Log4perl loggers can refer to without the application having to
28       pass around the context data between its functions.
29
30       Since in 5.8.0 perl's threads don't share data only upon request,
31       global data is by definition thread-specific.
32
33       Log::Log4perl::NDC->push($text);
34           Push an item onto the stack. If the stack grows beyond the defined
35           limit ($Log::Log4perl::NDC::MAX_SIZE), just the topmost element
36           will be replated.
37
38           This is typically done when a context is entered.
39
40       Log::Log4perl::NDC->pop();
41           Discard the upmost element of the stack. This is typically done
42           when a context is left.
43
44       my $text = Log::Log4perl::NDC->get();
45           Retrieve the content of the stack as a string of blank-separated
46           values without disrupting the stack structure. Typically done by
47           %x.  If the stack is empty the value "[undef]" is being returned.
48
49       Log::Log4perl::NDC->remove();
50           Reset the stack, remove all items.
51
52       Please note that all of the methods above are class methods, there's no
53       instances of this class.
54

LICENSE

56       Copyright 2002-2013 by Mike Schilli <m@perlmeister.com> and Kevin Goess
57       <cpan@goess.org>.
58
59       This library is free software; you can redistribute it and/or modify it
60       under the same terms as Perl itself.
61

AUTHOR

63       Please contribute patches to the project on Github:
64
65           http://github.com/mschilli/log4perl
66
67       Send bug reports or requests for enhancements to the authors via our
68
69       MAILING LIST (questions, bug reports, suggestions/patches):
70       log4perl-devel@lists.sourceforge.net
71
72       Authors (please contact them via the list above, not directly): Mike
73       Schilli <m@perlmeister.com>, Kevin Goess <cpan@goess.org>
74
75       Contributors (in alphabetical order): Ateeq Altaf, Cory Bennett, Jens
76       Berthold, Jeremy Bopp, Hutton Davidson, Chris R. Donnelly, Matisse
77       Enzer, Hugh Esco, Anthony Foiani, James FitzGibbon, Carl Franks, Dennis
78       Gregorovic, Andy Grundman, Paul Harrington, Alexander Hartmaier  David
79       Hull, Robert Jacobson, Jason Kohles, Jeff Macdonald, Markus Peter,
80       Brett Rann, Peter Rabbitson, Erik Selberg, Aaron Straup Cope, Lars
81       Thegler, David Viner, Mac Yang.
82
83
84
85perl v5.30.1                      2020-01-30                            NDC(3)
Impressum