public class StackdriverJsonLayout
extends ch.qos.logback.contrib.json.classic.JsonLayout
CONTEXT_ATTR_NAME, EXCEPTION_ATTR_NAME, FORMATTED_MESSAGE_ATTR_NAME, includeContextName, includeException, includeFormattedMessage, includeLevel, includeLoggerName, includeMDC, includeMessage, includeThreadName, LEVEL_ATTR_NAME, LOGGER_ATTR_NAME, MDC_ATTR_NAME, MESSAGE_ATTR_NAME, THREAD_ATTR_NAME, TIMESTAMP_ATTR_NAME| Constructor and Description |
|---|
StackdriverJsonLayout()
creates a layout for a Logback appender compatible to the Stackdriver log format.
|
| Modifier and Type | Method and Description |
|---|---|
protected String |
formatTraceId(String traceId) |
String |
getProjectId()
Get the project id.
|
boolean |
isIncludeExceptionInMessage()
check if there is an included exception in the message.
|
boolean |
isIncludeSpanId()
check if the span id is included.
|
boolean |
isIncludeTraceId()
check if the trace id is included.
|
void |
setCustomJson(String json)
set custom json data to include in log output.
|
void |
setIncludeExceptionInMessage(boolean includeExceptionInMessage)
set whether the exception is included in the message.
|
void |
setIncludeSpanId(boolean includeSpanId)
set whether the span id is included.
|
void |
setIncludeTraceId(boolean includeTraceId)
set whether the trace id is included.
|
void |
setProjectId(String projectId)
set the project id.
|
void |
setServiceContext(StackdriverErrorReportingServiceContext serviceContext)
set the service context for stackdriver.
|
void |
start() |
protected Map<String,Object> |
toJsonMap(ch.qos.logback.classic.spi.ILoggingEvent event)
Convert a logging event into a Map.
|
addCustomDataToJsonMap, addThrowableInfo, getThrowableProxyConverter, isIncludeContextName, isIncludeException, isIncludeFormattedMessage, isIncludeLevel, isIncludeLoggerName, isIncludeMDC, isIncludeMessage, isIncludeThreadName, setIncludeContextName, setIncludeException, setIncludeFormattedMessage, setIncludeLevel, setIncludeLoggerName, setIncludeMDC, setIncludeMessage, setIncludeThreadName, setThrowableProxyConverter, stopadd, addMap, addTimestamp, createDateFormat, doLayout, format, formatTimestamp, getContentType, getJsonFormatter, getTimestampFormat, getTimestampFormatTimezoneId, isAppendLineSeparator, isIncludeTimestamp, setAppendLineSeparator, setIncludeTimestamp, setJsonFormatter, setTimestampFormat, setTimestampFormatTimezoneIdgetContext, getFileFooter, getFileHeader, getPresentationFooter, getPresentationHeader, isStarted, setContext, setFileFooter, setFileHeader, setPresentationFooter, setPresentationHeaderaddError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getDeclaredOrigin, getStatusManagerpublic StackdriverJsonLayout()
public String getProjectId()
public void setProjectId(String projectId)
projectId - the Google Cloud project id relevant for logging the traceIdpublic boolean isIncludeTraceId()
public void setIncludeTraceId(boolean includeTraceId)
includeTraceId - true if the traceId should be included into the JSONpublic boolean isIncludeSpanId()
public void setIncludeSpanId(boolean includeSpanId)
includeSpanId - true if the spanId should be included into the JSONpublic boolean isIncludeExceptionInMessage()
public void setIncludeExceptionInMessage(boolean includeExceptionInMessage)
includeExceptionInMessage - true if the exception should be added to the messagepublic void setServiceContext(StackdriverErrorReportingServiceContext serviceContext)
serviceContext - the service contextpublic void setCustomJson(String json)
json - json stringpublic void start()
start in interface ch.qos.logback.core.spi.LifeCyclestart in class ch.qos.logback.contrib.json.classic.JsonLayoutprotected Map<String,Object> toJsonMap(ch.qos.logback.classic.spi.ILoggingEvent event)
toJsonMap in class ch.qos.logback.contrib.json.classic.JsonLayoutevent - the logging eventCopyright © 2020 Pivotal Software, Inc.. All rights reserved.