Class LoggedMdcKeys
MDC key names this library writes to while a @Logged
method is executing.
These keys are public and stable: a consuming application references
them directly in its own logging configuration (a Logback pattern layout,
a JSON encoder's field mappings, and so on) to have every log statement
made during a @Logged call — not just the summary line this
library itself emits — automatically carry the call's trace id, depth,
class, and method name. Without this, correlating an application's own
log.info(...) calls with a specific invocation in a structured
logging backend (Loki, ELK) requires manually threading that information
through every log statement by hand.
Every key is prefixed with logged. specifically to avoid
colliding with an MDC key a consuming application, or another library,
already uses for its own purposes (a bare traceId key, for
example, is common enough that a collision would be likely without this
prefix).
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe caller's IP address, the same value reported asMethodInvocationEvent.callerIp().static final StringThe class name resolved for the currently executing invocation, the same value reported asMethodInvocationEvent.className().static final StringTheFlowContext.depth()of the currently executing call within its chain, as a string.static final StringThe method name resolved for the currently executing invocation, the same value reported asMethodInvocationEvent.methodName().static final StringTheFlowContext.traceId()shared by every call in the same call chain. -
Method Summary
-
Field Details
-
TRACE_ID
TheFlowContext.traceId()shared by every call in the same call chain.- See Also:
-
DEPTH
TheFlowContext.depth()of the currently executing call within its chain, as a string.- See Also:
-
CLASS_NAME
The class name resolved for the currently executing invocation, the same value reported asMethodInvocationEvent.className().- See Also:
-
METHOD_NAME
The method name resolved for the currently executing invocation, the same value reported asMethodInvocationEvent.methodName().- See Also:
-
CALLER_IP
The caller's IP address, the same value reported asMethodInvocationEvent.callerIp(). Only written while executing a method annotated with@Logged(includeIp = true); absent for every other invocation.- See Also:
-