Package org.jboss.logmanager
Class ThreadLocalLogContextSelector
java.lang.Object
org.jboss.logmanager.ThreadLocalLogContextSelector
- All Implemented Interfaces:
LogContextSelector
A log context selector which stores the chosen log context in a thread-local.
- Author:
- David M. Lloyd
-
Constructor Summary
ConstructorsConstructorDescriptionThreadLocalLogContextSelector(Object securityKey, LogContextSelector delegate) Construct a new instance.Construct a new instance. -
Method Summary
Modifier and TypeMethodDescriptiongetAndSet(Object securityKey, LogContext newValue) Get and set the log context.Get the current log context.
-
Constructor Details
-
ThreadLocalLogContextSelector
Construct a new instance.- Parameters:
delegate- the selector to delegate to if no context is chosen
-
ThreadLocalLogContextSelector
Construct a new instance.- Parameters:
securityKey- the security key required to push or pop a log context.delegate- the selector to delegate to if no context is chosen
-
-
Method Details
-
getLogContext
Description copied from interface:LogContextSelectorGet the current log context.- Specified by:
getLogContextin interfaceLogContextSelector- Returns:
- the current log context
-
getAndSet
Get and set the log context.- Parameters:
securityKey- the security key to check (ignored if none was set on construction)newValue- the new log context value, ornullto clear- Returns:
- the previous log context value, or
nullif none was set
-