Package com.google.cloud.logging.logback
Class TraceLoggingEventEnhancer
- java.lang.Object
-
- com.google.cloud.logging.logback.TraceLoggingEventEnhancer
-
- All Implemented Interfaces:
LoggingEventEnhancer
public class TraceLoggingEventEnhancer extends Object implements LoggingEventEnhancer
Adds support for grouping logs by incoming http request
-
-
Constructor Summary
Constructors Constructor Description TraceLoggingEventEnhancer()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
clearTraceId()
Clearing a trace Id from the MDCvoid
enhanceLogEntry(com.google.cloud.logging.LogEntry.Builder builder, ch.qos.logback.classic.spi.ILoggingEvent e)
static String
getCurrentTraceId()
Get the Trace ID associated with any logging done by the current thread.static void
setCurrentTraceId(String id)
Set the Trace ID associated with any logging done by the current thread.
-
-
-
Method Detail
-
setCurrentTraceId
public static void setCurrentTraceId(String id)
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
public static String 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:
enhanceLogEntry
in interfaceLoggingEventEnhancer
-
-