Interface MappedDiagnosticContext

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

@GwtCompatible 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

    Modifier and Type
    Method
    Description
    void
    Clear all entries in the MDC of the underlying implementation.
    @Nullable String
    Get the context identified by the key parameter.
    A read only iterator delivering all key-value-pairs.
    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.
    void
    removeMDC(@NotNull String key)
    Remove the the context identified by the key parameter.

    Methods inherited from interface java.lang.Iterable

    forEach, spliterator
  • Method Details

    • putMDC

      void putMDC(@NotNull @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 @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 @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

      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