Package com.linkedin.venice.utils
Class LogContext
java.lang.Object
com.linkedin.venice.utils.LogContext
Utility class representing structured logging context information, such as
component and region name. Used to enrich log messages with identifying context
via Log4j2's
ThreadContext.-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final LogContextstatic final StringKey used in the logging context (e.g., ThreadContext/MDC) to tag log lines with the component and region name. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidgetValue()static LogContext.Builderstatic voidsetLogContext(LogContext logContext) static voidsetLogContext(Object logContext) toString()Returns a formatted string representation of the log context in the form:componentName|regionName.
-
Field Details
-
EMPTY
-
LOG_CONTEXT_KEY
Key used in the logging context (e.g., ThreadContext/MDC) to tag log lines with the component and region name. Helps disambiguate log output in multi-cluster or multi-component test setups.- See Also:
-
-
Method Details
-
setLogContext
-
setLogContext
-
clearLogContext
public static void clearLogContext() -
getRegionName
- Returns:
- The region name stored in this LogContext.
-
getComponentName
- Returns:
- The component name stored in this LogContext.
-
getInstanceName
- Returns:
- The instance name stored in this LogContext.
-
getValue
- Returns:
- The value of the log context in the form
componentName|regionName.
-
toString
Returns a formatted string representation of the log context in the form:componentName|regionName. -
newBuilder
- Returns:
- A new builder for constructing
LogContextinstances.
-