Class LogstashLoggingEventEnhancer

All Implemented Interfaces:, JsonLoggingEventEnhancer

public class LogstashLoggingEventEnhancer extends Object implements, 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( builder, ch.qos.logback.classic.spi.ILoggingEvent event)
      Specified by:
      enhanceLogEntry in interface
    • 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
      jsonMap - represents the JSON object that is produced by the Stackdriver JSON logging layout
      event - the Logback logging event