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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
enhanceJsonLogEntry
(Map<String, Object> jsonMap, ch.qos.logback.classic.spi.ILoggingEvent event) Add additional JSON data to the JSON log entry, based on theILoggingEvent
.void
enhanceLogEntry
(com.google.cloud.logging.LogEntry.Builder builder, ch.qos.logback.classic.spi.ILoggingEvent event)
-
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 interfacecom.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 theILoggingEvent
. Users should put additional records tojsonMap
to extend the JSON object that will be logged.- Specified by:
enhanceJsonLogEntry
in interfaceJsonLoggingEventEnhancer
- Parameters:
jsonMap
- represents the JSON object that is produced by the Stackdriver JSON logging layoutevent
- the Logback logging event
-