{
    "mode": "perldoc",
    "parameter": "Log::Log4perl::NDC",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/Log%3A%3ALog4perl%3A%3ANDC/json",
    "generated": "2026-06-09T13:35:23Z",
    "sections": {
        "NAME": {
            "content": "Log::Log4perl::NDC - Nested Diagnostic Context\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "Log::Log4perl allows loggers to maintain global thread-specific data, called the Nested\nDiagnostic Context (NDC).\n\nAt some point, the application might decide to push a piece of data onto the NDC stack, which\nother parts of the application might want to reuse. For example, at the beginning of a web\nrequest in a server, the application might decide to push the IP address of the client onto the\nstack to provide it for other loggers down the road without having to pass the data from\nfunction to function.\n\nThe Log::Log4perl::Layout::PatternLayout class even provides the handy %x placeholder which is\nreplaced by the blank-separated list of elements currently on the stack.\n\nThis module maintains a simple stack which you can push data on to, query what's on top, pop it\noff again or delete the entire stack.\n\nIts purpose is to provide a thread-specific context which all Log::Log4perl loggers can refer to\nwithout the application having to pass around the context data between its functions.\n\nSince in 5.8.0 perl's threads don't share data only upon request, global data is by definition\nthread-specific.\n\nLog::Log4perl::NDC->push($text);\nPush an item onto the stack. If the stack grows beyond the defined limit\n($Log::Log4perl::NDC::MAXSIZE), just the topmost element will be replated.\n\nThis is typically done when a context is entered.\n\nLog::Log4perl::NDC->pop();\nDiscard the upmost element of the stack. This is typically done when a context is left.\n\nmy $text = Log::Log4perl::NDC->get();\nRetrieve the content of the stack as a string of blank-separated values without disrupting\nthe stack structure. Typically done by %x. If the stack is empty the value \"[undef]\" is\nbeing returned.\n\nLog::Log4perl::NDC->remove();\nReset the stack, remove all items.\n\nPlease note that all of the methods above are class methods, there's no instances of this class.\n",
            "subsections": []
        },
        "LICENSE": {
            "content": "Copyright 2002-2013 by Mike Schilli <m@perlmeister.com> and Kevin Goess <cpan@goess.org>.\n\nThis library is free software; you can redistribute it and/or modify it under the same terms as\nPerl itself.\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Please contribute patches to the project on Github:\n\nhttp://github.com/mschilli/log4perl\n\nSend bug reports or requests for enhancements to the authors via our\n\nMAILING LIST (questions, bug reports, suggestions/patches): log4perl-devel@lists.sourceforge.net\n\nAuthors (please contact them via the list above, not directly): Mike Schilli\n<m@perlmeister.com>, Kevin Goess <cpan@goess.org>\n\nContributors (in alphabetical order): Ateeq Altaf, Cory Bennett, Jens Berthold, Jeremy Bopp,\nHutton Davidson, Chris R. Donnelly, Matisse Enzer, Hugh Esco, Anthony Foiani, James FitzGibbon,\nCarl Franks, Dennis Gregorovic, Andy Grundman, Paul Harrington, Alexander Hartmaier David Hull,\nRobert Jacobson, Jason Kohles, Jeff Macdonald, Markus Peter, Brett Rann, Peter Rabbitson, Erik\nSelberg, Aaron Straup Cope, Lars Thegler, David Viner, Mac Yang.\n",
            "subsections": []
        }
    },
    "summary": "Log::Log4perl::NDC - Nested Diagnostic Context",
    "flags": [],
    "examples": [],
    "see_also": []
}