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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clear all entries in the MDC of the underlying implementation.Get the context identified by thekeyparameter.Gets the map.static SLF4JMappedDiagnosticContextThe singleton.voidPut a context value (thevalparameter) as identified with thekeyparameter into the current thread's context map.voidRemoves the context identified by thekeyparameter 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:MappedDiagnosticContextPut a context value (thevalparameter) as identified with thekeyparameter into the current thread's context map. Thekeyparameter cannot be null. Thevalparameter 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:MappedDiagnosticContextGet the context identified by thekeyparameter. Thekeyparameter 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
keyparameter.
-
remove
Description copied from interface:MappedDiagnosticContextRemoves the context identified by thekeyparameter using the underlying system's MDC implementation. Thekeyparameter 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:MappedDiagnosticContextClear all entries in the MDC of the underlying implementation. -
getContext
Description copied from class:AbstractMappedDiagnosticContextGets the map.Note: may be a copy of the internal map, i.e. modifications may not show up in the real MDC.
- Specified by:
getContextin classAbstractMappedDiagnosticContext- Returns:
- the key/value map, never null
-