module RJack::SLF4J::MDC

Mapped Diagnostic Context support module

Note that this optional module can only be loaded after a output adapter has been loaded. Otherwise the following output is printed and Exception will be thrown:

SLF4J: Failed to load class "org.slf4j.impl.StaticMDCBinder".
SLF4J: See http://www.slf4j.org/codes.html#no_static_mdc_binder for further details.
java.lang.NoClassDefFoundError: org/slf4j/impl/StaticMDCBinder

Public Class Methods

[]( key ) click to toggle source

Get value associated with key, or nil.

# File lib/rjack-slf4j/mdc.rb, line 34
def self.[]( key )
  org.slf4j.MDC::get( key.to_s )
end
[]=( key, val ) click to toggle source

Associate val with key, or remove key is value is nil.

# File lib/rjack-slf4j/mdc.rb, line 39
def self.[]=( key, val )
  if val
    org.slf4j.MDC::put( key.to_s, val.to_s )
  else
    org.slf4j.MDC::remove( key.to_s )
  end
end