de.espirit.common.base
Interface MappedDiagnosticContext

All Superinterfaces:
Iterable<Map.Entry<String,String>>

public interface MappedDiagnosticContext
extends Iterable<Map.Entry<String,String>>

This class hides and serves as a substitute for the underlying logging system's MDC (mapped diagnostic context) implementation.

Since:
4.1.46

Method Summary
 void clearMDC()
          Clear all entries in the MDC of the underlying implementation.
 String getMDC(String key)
          Get the context identified by the key parameter.
 Iterator<Map.Entry<String,String>> iterator()
          A read only iterator delivering all key-value-pairs.
 void putMDC(String key, String val)
          Put a context value (the val parameter) as identified with the key parameter into the current thread's context map.
 void removeMDC(String key)
          Remove the the context identified by the key parameter.
 

Method Detail

putMDC

void putMDC(@NotNull
            String key,
            String val)
Put a context value (the val parameter) as identified with the key parameter into the current thread's context map. The key parameter cannot be null. The val parameter can be null only if the underlying implementation supports it.

Parameters:
key - Key to put for.
val - Value to put.
Since:
4.1.46

getMDC

@Nullable
String getMDC(String key)
Get the context identified by the key parameter.

Parameters:
key - Key to query.
Returns:
the mapped value or null
Since:
4.1.46

removeMDC

void removeMDC(@NotNull
               String key)
Remove the the context identified by the key parameter.

Parameters:
key - Key to remove
Since:
4.1.46

clearMDC

void clearMDC()
Clear all entries in the MDC of the underlying implementation.

Since:
4.1.46

iterator

Iterator<Map.Entry<String,String>> iterator()
A read only iterator delivering all key-value-pairs.

Specified by:
iterator in interface Iterable<Map.Entry<String,String>>
Returns:
A read only iterator delivering all key-value-pairs.
Since:
4.2.477


Copyright © 2012 e-Spirit AG. All Rights Reserved. Build 4.2.480