public final class LoggingContext
extends java.lang.Object
Logging context is a wrapper for ThreadContext. Therefore, all operations also affect the
ThreadContext and vice versa.
If values will be stored by a thread from a thread pool, clear() should be called before putting the thread
back to the pool.
| Modifier and Type | Method | Description |
|---|---|---|
static void |
clear() |
Removes all existing values from logging context.
|
static java.lang.String |
get(java.lang.String key) |
Gets a value by key from logging context.
|
static java.util.Map<java.lang.String,java.lang.String> |
getMapping() |
Gets all values that are visible for the current thread from logging context.
|
static void |
put(java.lang.String key,
java.lang.Object value) |
Stores a value in logging context.
|
static void |
remove(java.lang.String key) |
Removes a value from logging context.
|
public static java.util.Map<java.lang.String,java.lang.String> getMapping()
The returned map is either read-only or a mutable copy. It cannot used to modify the logging context itself.
public static java.lang.String get(java.lang.String key)
key - Key of mappingnullpublic static void put(java.lang.String key,
java.lang.Object value)
key - Key of mappingvalue - Value of mappingpublic static void remove(java.lang.String key)
key - Key of mappingpublic static void clear()
Copyright © 2022. All rights reserved.