Class TraceLoggingEventEnhancer

    • Constructor Detail

      • TraceLoggingEventEnhancer

        public TraceLoggingEventEnhancer()
    • 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 interface LoggingEventEnhancer