public final class LoggingContext extends 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 and Description |
---|---|
static void |
clear()
Removes all existing values from logging context.
|
static String |
get(String key)
Gets a value by key from logging context.
|
static Map<String,String> |
getMapping()
Gets all values that are visible for the current thread from logging context.
|
static void |
put(String key,
Object value)
Stores a value in logging context.
|
static void |
remove(String key)
Removes a value from logging context.
|
public static Map<String,String> getMapping()
The returned map is either read-only or a mutable copy. It cannot used to modify the logging context itself.
public static String get(String key)
key
- Key of mappingnull
public static void put(String key, Object value)
key
- Key of mappingvalue
- Value of mappingpublic static void remove(String key)
key
- Key of mappingpublic static void clear()
Copyright © 2020. All rights reserved.