InheritableMDC

ox.logback.InheritableMDC

Provides support for MDC which is inheritable across (virtual) threads. Only MDC values set using the where method will be inherited; this method also defines the scope, within which the provided MDC values are available.

The semantics of MDC.put are unchanged: values set using this method will only be visible in the original thread. That is because the "usual" MDC usage is unstructured, and we don't want to set values for the entire scope (which might exceed the calling thread).

Internally, a ForkLocal (backed by a ScopedValue) is used, to store the scoped context.

Prior to using inheritable MDCs, the init method has to be called. This performs some operations using the reflection API, to substitute Logback's MDC support with one that is scope-aware.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

def supervisedErrorWhere[E, F[_], U](errorMode: ErrorMode[E, F])(kvs: (String, String)*)(f: (OxError[E, F]) ?=> F[U]): F[U]

Set the given MDC key-value mappings as passed in kvs, for the duration of evaluating f. The values will be available for any forks created within f.

Set the given MDC key-value mappings as passed in kvs, for the duration of evaluating f. The values will be available for any forks created within f.

Attributes

See also

Usage notes on ForkLocal.supervisedErrorWhere.

def supervisedWhere[T](kvs: (String, String)*)(f: Ox ?=> T): T

Set the given MDC key-value mappings as passed in kvs, for the duration of evaluating f. The values will be available for any forks created within f.

Set the given MDC key-value mappings as passed in kvs, for the duration of evaluating f. The values will be available for any forks created within f.

Attributes

See also

Usage notes on ForkLocal.supervisedWhere.

def unsupervisedWhere[T](kvs: (String, String)*)(f: OxUnsupervised ?=> T): T

Set the given MDC key-value mappings as passed in kvs, for the duration of evaluating f. The values will be available for any forks created within f.

Set the given MDC key-value mappings as passed in kvs, for the duration of evaluating f. The values will be available for any forks created within f.

Attributes

See also

Usage notes on ForkLocal.unsupervisedWhere.

Concrete fields

lazy val init: Unit

Initialise inheritable MDCs. Must be called as early in the app's code as possible.

Initialise inheritable MDCs. Must be called as early in the app's code as possible.

Attributes