java.lang.Object
org.tentackle.log.AbstractMappedDiagnosticContext
org.tentackle.log.slf4j.SLF4JMappedDiagnosticContext
- All Implemented Interfaces:
MappedDiagnosticContext
@Service(SLF4JMappedDiagnosticContext.class)
public class SLF4JMappedDiagnosticContext
extends AbstractMappedDiagnosticContext
The SLF4J mdc implementation.
- Author:
- harald
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clear all entries in the MDC of the underlying implementation.Get the context identified by thekey
parameter.Gets the map.static SLF4JMappedDiagnosticContext
The singleton.void
Put a context value (theval
parameter) as identified with thekey
parameter into the current thread's context map.void
Removes the context identified by thekey
parameter using the underlying system's MDC implementation.Methods inherited from class org.tentackle.log.AbstractMappedDiagnosticContext
getKeys, matchesPattern, toString
-
Constructor Details
-
SLF4JMappedDiagnosticContext
public SLF4JMappedDiagnosticContext()Creates the MDC for SLF4J.
-
-
Method Details
-
getInstance
The singleton.- Returns:
- the singleton
-
put
Description copied from interface:MappedDiagnosticContext
Put a context value (theval
parameter) as identified with thekey
parameter into the current thread's context map. Thekey
parameter cannot be null. Theval
parameter can be null only if the underlying implementation supports it.This method delegates all work to the MDC of the underlying logging system.
Throws IllegalArgumentException in case the "key" parameter is null.
- Parameters:
key
- the keyval
- the value
-
get
Description copied from interface:MappedDiagnosticContext
Get the context identified by thekey
parameter. Thekey
parameter cannot be null.This method delegates all work to the MDC of the underlying logging system.
Throws IllegalArgumentException in case the "key" parameter is null.
- Parameters:
key
- the key- Returns:
- the string value identified by the
key
parameter.
-
remove
Description copied from interface:MappedDiagnosticContext
Removes the context identified by thekey
parameter using the underlying system's MDC implementation. Thekey
parameter cannot be null. This method does nothing if there is no previous value associated withkey
.Throws IllegalArgumentException in case the "key" parameter is null.
- Parameters:
key
- the key
-
clear
public void clear()Description copied from interface:MappedDiagnosticContext
Clear all entries in the MDC of the underlying implementation. -
getContext
Description copied from class:AbstractMappedDiagnosticContext
Gets the map.Note: may be a copy of the internal map, i.e. modifications may not show up in the real MDC.
- Specified by:
getContext
in classAbstractMappedDiagnosticContext
- Returns:
- the key/value map, never null
-