Interface ContextDataProvider

  • All Known Implementing Classes:
    ThreadContextDataProvider

    public interface ContextDataProvider
    Source of context data to be added to each log event.
    • Method Detail

      • supplyContextData

        java.util.Map<java.lang.String,​java.lang.String> supplyContextData()
        Returns a Map containing context data to be injected into the event or null if no context data is to be added.

        Thread-safety note: The returned object can safely be passed off to another thread: future changes in the underlying context data will not be reflected in the returned object.

        Returns:
        A Map containing the context data or null.
      • supplyStringMap

        default StringMap supplyStringMap()
        Returns the context data as a StringMap.

        Thread-safety note: The returned object can safely be passed off to another thread: future changes in the underlying context data will not be reflected in the returned object.

        Returns:
        the context data in a StringMap.
      • getValue

        default java.lang.Object getValue​(java.lang.String key)
        Retrieves a single context data value.

        This method avoids the overhead of copying the entire context data, when only a single value is needed.

        Parameters:
        key - The context data key of the value to retrieve.
        Returns:
        A context data value.
        Since:
        2.24.0