public class CloseableThreadContext extends Object
stack or map
and them removes them when the object is closed, e.g. as part
of a try-with-resources.Modifier and Type | Class and Description |
---|---|
static class |
CloseableThreadContext.Instance |
Modifier and Type | Method and Description |
---|---|
static CloseableThreadContext.Instance |
push(String message)
Pushes new diagnostic context information on to the Thread Context Stack.
|
static CloseableThreadContext.Instance |
push(String message,
Object... args)
Pushes new diagnostic context information on to the Thread Context Stack.
|
static CloseableThreadContext.Instance |
put(String key,
String value)
Populates the Thread Context Map with the supplied key/value pairs.
|
public static CloseableThreadContext.Instance push(String message)
message
- The new diagnostic context information.public static CloseableThreadContext.Instance push(String message, Object... args)
message
- The new diagnostic context information.args
- Parameters for the message.public static CloseableThreadContext.Instance put(String key, String value)
ThreadContext
will be replaced with the supplied values, and restored back to their original values when
the instance is closed.key
- The key to be addedvalue
- The value to be addedCopyright © 1999-2016 Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.