JBoss Logging 3.3.2.Final

org.jboss.logging
Class MDC

java.lang.Object
  extended by org.jboss.logging.MDC

public final class MDC
extends java.lang.Object

Mapped diagnostic context. Each log provider implementation may behave different.


Method Summary
static void clear()
          Clears the message diagnostics context.
static java.lang.Object get(java.lang.String key)
          Returns the value for the key or null if no value was found.
static java.util.Map<java.lang.String,java.lang.Object> getMap()
          Returns the map from the context.
static java.lang.Object put(java.lang.String key, java.lang.Object val)
          Puts the value onto the context.
static void remove(java.lang.String key)
          Removes the value from the context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

put

public static java.lang.Object put(java.lang.String key,
                                   java.lang.Object val)
Puts the value onto the context.

Parameters:
key - the key for the value
val - the value
Returns:
the previous value set or null if no value was set

get

public static java.lang.Object get(java.lang.String key)
Returns the value for the key or null if no value was found.

Parameters:
key - the key to lookup the value for
Returns:
the value or null if not found

remove

public static void remove(java.lang.String key)
Removes the value from the context.

Parameters:
key - the key of the value to remove

getMap

public static java.util.Map<java.lang.String,java.lang.Object> getMap()
Returns the map from the context.

Note that in most implementations this is an expensive operation and should be used sparingly.

Returns:
the map from the context or an empty map if the context is null

clear

public static void clear()
Clears the message diagnostics context.


JBoss Logging 3.3.2.Final

Copyright © 2015 Red Hat, Inc.