Sha256: 10ead1c0810ecbc7abd323efefe658d7f6f99fc35192cad0d3a5d8e3d8aef1e4

Contents?: true

Size: 1.51 KB

Versions: 133

Compression:

Stored size: 1.51 KB

Contents

= NDC

The NDC class implements a copy of the Nested Diagnostic Context, which
is part of the Apache Log4j library.  Nested Diagnostic Contexts were
derived from Neil Harrison's article on "Patterns for Logging
Diagnostic Messages", part of the book "Pattern Languages of Program
Design 3" edited by Martin et al.

NDCs in Log4r are thread safe.

NDCs in log4r are close enough to NDCs in Log4j that I include its
documentation directly:

...
A Nested Diagnostic Context, or NDC in short, is an instrument to
distinguish interleaved log output from different sources. Log output
is typically interleaved when a server handles multiple clients
near-simultaneously.

Interleaved log output can still be meaningful if each log entry from
different contexts had a distinctive stamp. This is where NDCs come into
play.

Note that NDCs are managed on a per thread basis. NDC operations such as
push, pop(), clear(), getDepth() and setMaxDepth(int) affect the NDC of
the current thread only. NDCs of other threads remain unaffected.
...

An important difference between NDCs in Log4r vs Log4j is that you
do not have to called NDC.remove() when exiting a thread.

This class will automatically create Thread specific storage for the 
current thread on the first call to any of its methods, i.e.

  NDC.push( "client accept" );

New threads may inherit the NDC of the parent thread by making use of
the clone_stack() and inherit() methods.  By default, the NDC is not
inherited automatically.  This is unlike MDCs, which will inherit from
the main thread.

Version data entries

133 entries across 95 versions & 16 rubygems

Version Path
depengine-0.0.11 etc/isolate/jruby-1.8/gems/log4r-1.1.8/lib/log4r/rdoc/NDC
depengine-0.0.10 etc/isolate/jruby-1.8/gems/log4r-1.1.8/lib/log4r/rdoc/NDC
depengine-0.0.10 etc/isolate/ruby-1.8/gems/log4r-1.1.8/lib/log4r/rdoc/NDC
vagrant-actionio-0.0.9 vendor/bundle/gems/log4r-1.1.10/lib/log4r/rdoc/NDC
depengine-0.0.9 etc/isolate/jruby-1.8/gems/log4r-1.1.8/lib/log4r/rdoc/NDC
depengine-0.0.9 etc/isolate/ruby-1.8/gems/log4r-1.1.8/lib/log4r/rdoc/NDC
depengine-0.0.8 etc/isolate/ruby-1.8/gems/log4r-1.1.8/lib/log4r/rdoc/NDC
depengine-0.0.8 etc/isolate/jruby-1.8/gems/log4r-1.1.8/lib/log4r/rdoc/NDC
depengine-0.0.7 etc/isolate/ruby-1.8/gems/log4r-1.1.8/lib/log4r/rdoc/NDC
depengine-0.0.7 etc/isolate/jruby-1.8/gems/log4r-1.1.8/lib/log4r/rdoc/NDC
depengine-0.0.5 etc/isolate/jruby-1.8/gems/log4r-1.1.8/lib/log4r/rdoc/NDC
depengine-0.0.5 etc/isolate/ruby-1.8/gems/log4r-1.1.8/lib/log4r/rdoc/NDC
depengine-0.0.4 etc/isolate/ruby-1.8/gems/log4r-1.1.8/lib/log4r/rdoc/NDC
depengine-0.0.4 etc/isolate/jruby-1.8/gems/log4r-1.1.8/lib/log4r/rdoc/NDC
depengine-0.0.3 etc/isolate/jruby-1.8/gems/log4r-1.1.8/lib/log4r/rdoc/NDC
depengine-0.0.3 etc/isolate/ruby-1.8/gems/log4r-1.1.8/lib/log4r/rdoc/NDC
depengine-0.0.2 etc/isolate/jruby-1.8/gems/log4r-1.1.8/lib/log4r/rdoc/NDC
depengine-0.0.2 etc/isolate/ruby-1.8/gems/log4r-1.1.8/lib/log4r/rdoc/NDC
depengine-0.0.1 etc/isolate/jruby-1.8/gems/log4r-1.1.8/lib/log4r/rdoc/NDC
depengine-0.0.1 etc/isolate/ruby-1.8/gems/log4r-1.1.8/lib/log4r/rdoc/NDC