public class PaxContext extends Object
The MDC class that provides mapped diagnostic contexts.
A Mapped Diagnostic Context, or MDC in short, is an instrument for distinguishing interleaved log output from different sources. Log output is typically interleaved when a server handles multiple clients near-simultaneously.
The MDC is managed on a per thread basis. A child thread automatically
inherits a copy of the mapped diagnostic context of its parent (with normal
InheritableThreadLocal child inherits the same references). That behavior can be switched
off by setting the system property org.ops4j.pax.logging.threadContextMapInheritable to
false (default is true).
The MDC class requires JDK 1.2 or above. Under JDK 1.1 the MDC will always return empty values but otherwise will not affect or harm your application.
| Constructor and Description |
|---|
PaxContext() |
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clears entire thread-bound MDC context.
|
Object |
get(String key)
Gets a value from this thread-bound MDC context.
|
Map<String,Object> |
getContext()
Gets full map of values related to this thread-bound MDC context.
|
Map<String,Object> |
getCopyOfContextMap()
Gets a copy of full map of calues related to this thread-bound MDC context.
|
void |
put(String key,
Object o)
Sets single value in this thread-bound MDC context.
|
void |
putAll(Map<String,Object> context)
Sets all values from passed map in this thread-bound MDC context.
|
void |
remove(String key)
Removes a value from this thread-bound MDC context.
|
void |
setContextMap(Map<String,Object> contextMap)
Sets all values from passed map in this thread-bound MDC context.
|
public void putAll(Map<String,Object> context)
context - public void put(String key, Object o)
key - o - public Object get(String key)
key - public void remove(String key)
key - public Map<String,Object> getContext()
public Map<String,Object> getCopyOfContextMap()
public void clear()
Copyright © 2006–2020 OPS4J - Open Participation Software for Java. All rights reserved.