Class LogstashLoggingEventEnhancer

java.lang.Object
com.google.cloud.spring.logging.extensions.LogstashLoggingEventEnhancer
All Implemented Interfaces:
com.google.cloud.logging.logback.LoggingEventEnhancer, JsonLoggingEventEnhancer

public class LogstashLoggingEventEnhancer extends Object implements com.google.cloud.logging.logback.LoggingEventEnhancer, JsonLoggingEventEnhancer
Logging enhancer which adds Logstash markers to Logging API calls and JSON log entries.

Supported Markers: - ObjectAppendingMarker: key-value pairs are added to the log entries.

This can be used by specifying this class in a <loggingEventEnhancer> element for your LoggingAppender or StackdriverJsonLayout definitions in logback.xml.

  • Constructor Details

    • LogstashLoggingEventEnhancer

      public LogstashLoggingEventEnhancer()
  • Method Details

    • enhanceLogEntry

      public void enhanceLogEntry(com.google.cloud.logging.LogEntry.Builder builder, ch.qos.logback.classic.spi.ILoggingEvent event)
      Specified by:
      enhanceLogEntry in interface com.google.cloud.logging.logback.LoggingEventEnhancer
    • enhanceJsonLogEntry

      public void enhanceJsonLogEntry(Map<String,Object> jsonMap, ch.qos.logback.classic.spi.ILoggingEvent event)
      Description copied from interface: JsonLoggingEventEnhancer
      Add additional JSON data to the JSON log entry, based on the ILoggingEvent. Users should put additional records to jsonMap to extend the JSON object that will be logged.
      Specified by:
      enhanceJsonLogEntry in interface JsonLoggingEventEnhancer
      Parameters:
      jsonMap - represents the JSON object that is produced by the Stackdriver JSON logging layout
      event - the Logback logging event