Package com.google.cloud.logging.logback
Class TraceLoggingEventEnhancer
java.lang.Object
com.google.cloud.logging.logback.TraceLoggingEventEnhancer
- All Implemented Interfaces:
LoggingEventEnhancer
Adds support for grouping logs by incoming http request
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidClearing a trace Id from the MDCvoidenhanceLogEntry(com.google.cloud.logging.LogEntry.Builder builder, ch.qos.logback.classic.spi.ILoggingEvent e) static StringGet the Trace ID associated with any logging done by the current thread.static voidSet the Trace ID associated with any logging done by the current thread.
-
Constructor Details
-
TraceLoggingEventEnhancer
public TraceLoggingEventEnhancer()
-
-
Method Details
-
setCurrentTraceId
Set the Trace ID associated with any logging done by the current thread.- Parameters:
id- The traceID, in the form projects/[PROJECT_ID]/traces/[TRACE_ID]
-
clearTraceId
public static void clearTraceId()Clearing a trace Id from the MDC -
getCurrentTraceId
Get the Trace ID associated with any logging done by the current thread.- Returns:
- id The traceID
-
enhanceLogEntry
public void enhanceLogEntry(com.google.cloud.logging.LogEntry.Builder builder, ch.qos.logback.classic.spi.ILoggingEvent e) - Specified by:
enhanceLogEntryin interfaceLoggingEventEnhancer
-