object ThreadAttributes
Provides a convenient mechanism for associating thread-specific attributes with your log entries.
Loggers will copy the thread-specific attributes available through this object
(ThreadAttributes.get()) into the threadAttributes field of every entry they create.
Thread attribute values are stacked, making it possible to push an attribute value for a specific code block and
then pop the value from the attribute stack, leaving the thread attributes in the state that was present before
the block was executed. This is directly implemented in the during() method calls. It can also be managed
explicitly by the calling code (e.g., when the push and pop operations need to span method bodies) using the
push and pop methods.
- Alphabetic
- By Inheritance
- ThreadAttributes
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clear: Unit
Removes all thread attributes.
Removes all thread attributes. This includes all stacked values.
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def during[A](attributes: Map[String, String])(fn: => A): A
Executes a thunk, during which the specified thread attributes will be in place.
Executes a thunk, during which the specified thread attributes will be in place. After the thunk has completed, the thread attributes are returned to their original values (before the call to
during). The return value of the call is the return value of the thunk.- A
the return type of the thunk
- attributes
the thread attribute names and values to push during the thunk execution
- fn
the thunk to execute
- returns
the return value of the executed thunk
- def during[A](name: String, value: String)(fn: => A): A
Executes a thunk, during which the specified thread attribute will be in place.
Executes a thunk, during which the specified thread attribute will be in place. After the thunk has completed, the thread attribute is returned to its original value (before the call to
during). The return value of the call is the return value of the thunk.- A
the return type of the thunk
- name
the name of the thread attribute to set
- value
the value of the named thread attribute
- fn
the thunk to execute
- returns
the return value of the executed thunk
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- def get: Map[String, List[String]]
Retrieves the current thread attributes.
Retrieves the current thread attributes.
- returns
the stack of values for each attribute on this thread as a map of lists
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def getTopmost: Map[String, String]
Retrieves the current thread attributes.
Retrieves the current thread attributes.
- returns
the topmost value on the stack for each attribute on this thread as a map
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def pop(attributes: Map[String, String]): Unit
Pops a collection of old values from the stacks for the named thread attributes.
Pops a collection of old values from the stacks for the named thread attributes. The expected values must match the values on tops of the stacks, or else an exception will be thrown. This is to protect against programming errors where the
pushandpopcalls don't match up.- attributes
a map of the thread attribute names to pop and the expected value for each
- def pop(name: String, value: String): Unit
Pops an old value from the stack for the named thread attribute.
Pops an old value from the stack for the named thread attribute. The expected value must be specified and, if it does not match the value on top of the stack, will throw an exception. This is to protect against programming errors where the
pushandpopcalls don't match up.- name
the name of the attribute for which to pop a value
- value
the expected value to pop for the named attribute
- def push(attributes: Map[String, String]): Unit
Pushes a collection of values onto the stacks of several thread attributes.
Pushes a collection of values onto the stacks of several thread attributes.
- attributes
the thread attribute names and values to push
- def push(name: String, value: String): Unit
Pushes a new value onto the stack for the named thread attribute.
Pushes a new value onto the stack for the named thread attribute.
- name
the name of the attribute for which to push a value
- value
the value to push for the named attribute
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()