Annotation Interface OfLog4jContext


@Retention(RUNTIME) @Target({METHOD,PARAMETER}) public @interface OfLog4jContext
Specifies the binding point for a Log4j ThreadContext value. The annotation can be applied on both the client side, i.e., ByJms interfaces, and the server side, i.e., ForJmsType classes.

On the client side, applied to a parameter on a ByJms interface, it specifies the key and value for ThreadContext.

On the server side, applied to a parameter of a ForJmsType Invoking method, it specifies the supplier parameter for the value of the named context.

When applied to a parameter, the context value will be supplied by the argument via Object.toString().

The annotation can also be applied to a supplier method defined by the type of the body parameter on either the client side and the server side. The supplier method must

  • be declared on the type directly, no recursion or inheritance
  • public
  • have no parameter
  • return a value
The return value will be converted to String via Object.toString(). If no name is specified by the annotation, the method name will be used as the context key.

null will be converted to string "null".

Since:
2.3.1
Author:
Lei Yang
See Also:
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Specifies the name of the ThreadContext.
  • Element Details

    • value

      String value
      Specifies the name of the ThreadContext.

      When no value is specified, the context name is inferred from the parameter name. For this to work properly, '-parameters' compiler option is desired.

      Default:
      ""