Interface LoggingContextFacility
-
- All Known Implementing Classes:
NullLoggingContextFacilityImpl
public interface LoggingContextFacility
Entry point for Resource Adaptors to interact with logging MDC
- Since:
- Rhino 2.6.0
-
-
Field Summary
Fields Modifier and Type Field Description static String
CONFIG_PROPERTY_NAME
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
clearThreadContext()
Clears the current thread’s logging context.Map<String,String>
getImmutableActivityContext(ActivityHandle activityHandle)
Gets an immutable copy of the activity’s logging context.Map<String,String>
getImmutableThreadContext()
Gets an immutable copy of the current thread’s logging context.void
put(String key, String value)
Add a single key/value pair to the current thread’s logging context.void
put(ActivityHandle activityHandle, String key, String value)
Add a key value pair to this activity’s logging context.void
putAll(Map<String,String> entries)
Add a map of key/value pairs to the current thread’s logging context.void
putAll(ActivityHandle activityHandle, Map<String,String> entries)
Put all context entries into the current logging context.void
remove(String key)
Remove a key from the current thread’s logging context.void
remove(ActivityHandle activityHandle, String key)
Remove an entry from the logging context.
-
-
-
Field Detail
-
CONFIG_PROPERTY_NAME
static final String CONFIG_PROPERTY_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
getImmutableActivityContext
Map<String,String> getImmutableActivityContext(ActivityHandle activityHandle) throws UnrecognizedActivityHandleException
Gets an immutable copy of the activity’s logging context.
Intended for use when calling up from the network, to fetch the existing state of an activity, once the activity is known.
- Parameters:
activityHandle
- Activity handle for the activity to get the Logging context for.- Returns:
- Map<String, String> context
- Throws:
UnrecognizedActivityHandleException
- Since:
- Rhino 2.6.0
-
getImmutableThreadContext
Map<String,String> getImmutableThreadContext()
Gets an immutable copy of the current thread’s logging context.
Intended for use by components with internal thread pools, to manage moving a logging context between an RA internal thread, and an activity plus rhino thread.
- Returns:
- Map<String, String> context
- Since:
- Rhino 2.6.0
-
clearThreadContext
void clearThreadContext()
Clears the current thread’s logging context.
Provided for use by components with internal thread pools, to remove the logging context from an RA internal thread when the thread has completed work associated with an activity.
- Since:
- Rhino 2.6.0
-
put
void put(String key, String value)
Add a single key/value pair to the current thread’s logging context. This does not modify the logging context of any activities directly. Provided for use by RAs before an activity has been started/located, for example in a network IO thread.
- Parameters:
key
- String context key to add to the thread’s logging contextvalue
- String context value to add to the thread’s logging context- Since:
- Rhino 2.6.0
-
putAll
void putAll(Map<String,String> entries)
Add a map of key/value pairs to the current thread’s logging context. This does not modify the logging context of any activities directly. Provided for use by RAs before an activity has been started/located, for example in a network IO thread.
- Parameters:
entries
- Map of key, value pairs to add to the thread’s logging context- Since:
- Rhino 2.6.0
-
remove
void remove(String key)
Remove a key from the current thread’s logging context. This does not modify the logging context of any activities directly. Provided for use by RAs before an activity has been started/located, for example in a network IO thread.
- Parameters:
key
- String key to remove from the thread’s logging context- Since:
- Rhino 2.6.0
-
put
void put(ActivityHandle activityHandle, String key, String value) throws UnrecognizedActivityHandleException
Add a key value pair to this activity’s logging context. It will be logged in all subsequent log statements for this activity.
Care must be taken to not overload the context with too many entries.
- Parameters:
key
- String key to add.value
- String value to add.- Throws:
UnrecognizedActivityHandleException
- if the handle is null, or does not point to a live activity- Since:
- Rhino 2.6.0
-
putAll
void putAll(ActivityHandle activityHandle, Map<String,String> entries) throws UnrecognizedActivityHandleException
Put all context entries into the current logging context. It will be logged in all subsequent log statements for this activity.
Care must be taken to not overload the context with too many entries.
- Parameters:
entries
- String key and value pairs to add- Throws:
UnrecognizedActivityHandleException
- if the handle is null, or does not point to a live activity- Since:
- Rhino 2.6.0
-
remove
void remove(ActivityHandle activityHandle, String key) throws UnrecognizedActivityHandleException
Remove an entry from the logging context. This entry will not be logged after this call.
- Parameters:
key
- String key to remove.- Throws:
UnrecognizedActivityHandleException
- if the handle is null, or does not point to a live activity- Since:
- Rhino 2.6.0
-
-