public class LogstashEncoder extends LoggingEventCompositeJsonEncoder
Constructor and Description |
---|
LogstashEncoder() |
Modifier and Type | Method and Description |
---|---|
void |
addExcludeMdcKeyName(String excludedMdcKeyName) |
void |
addIncludeMdcKeyName(String includedMdcKeyName) |
void |
addProvider(JsonProvider<ch.qos.logback.classic.spi.ILoggingEvent> provider) |
protected CompositeJsonFormatter<ch.qos.logback.classic.spi.ILoggingEvent> |
createFormatter() |
String |
getCustomFields() |
List<String> |
getExcludeMdcKeyNames() |
LogstashFieldNames |
getFieldNames() |
protected LogstashFormatter |
getFormatter() |
List<String> |
getIncludeMdcKeyNames() |
int |
getShortenedLoggerNameLength() |
ch.qos.logback.classic.pattern.ThrowableHandlingConverter |
getThrowableConverter() |
String |
getTimeZone() |
int |
getVersion() |
boolean |
isEnableContextMap()
Deprecated.
When logging, prefer using a
Markers.appendEntries(Map) marker instead. |
boolean |
isIncludeCallerData() |
boolean |
isIncludeCallerInfo()
Deprecated.
use
isIncludeCallerData() (to use the same name that logback uses) |
boolean |
isIncludeContext() |
boolean |
isIncludeMdc() |
boolean |
isWriteVersionAsString() |
void |
setCustomFields(String customFields) |
void |
setEnableContextMap(boolean enableContextMap)
Deprecated.
When logging, prefer using a
Markers.appendEntries(Map) marker instead. |
void |
setExcludeMdcKeyNames(List<String> excludeMdcKeyNames) |
void |
setFieldNames(LogstashFieldNames fieldNames) |
void |
setIncludeCallerData(boolean includeCallerData) |
void |
setIncludeCallerInfo(boolean includeCallerInfo)
Deprecated.
use
setIncludeCallerData(boolean) (to use the same name that logback uses) |
void |
setIncludeContext(boolean includeContext) |
void |
setIncludeMdc(boolean includeMdc) |
void |
setIncludeMdcKeyNames(List<String> includeMdcKeyNames) |
void |
setShortenedLoggerNameLength(int length) |
void |
setThrowableConverter(ch.qos.logback.classic.pattern.ThrowableHandlingConverter throwableConverter) |
void |
setTimeZone(String timeZoneId) |
void |
setVersion(int version) |
void |
setWriteVersionAsString(boolean writeVersionAsString) |
setProviders
close, doEncode, getEncoding, getJsonFactoryDecorator, getJsonGeneratorDecorator, getLineSeparator, getPrefix, getProviders, getSuffix, init, isImmediateFlush, setEncoding, setImmediateFlush, setJsonFactoryDecorator, setJsonGeneratorDecorator, setLineSeparator, setPrefix, setSuffix, start, stop
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, getDeclaredOrigin, getStatusManager, setContext
protected CompositeJsonFormatter<ch.qos.logback.classic.spi.ILoggingEvent> createFormatter()
createFormatter
in class LoggingEventCompositeJsonEncoder
protected LogstashFormatter getFormatter()
getFormatter
in class CompositeJsonEncoder<ch.qos.logback.classic.spi.ILoggingEvent>
public void addProvider(JsonProvider<ch.qos.logback.classic.spi.ILoggingEvent> provider)
public boolean isIncludeCallerData()
public void setIncludeCallerData(boolean includeCallerData)
@Deprecated public boolean isIncludeCallerInfo()
isIncludeCallerData()
(to use the same name that logback uses)@Deprecated public void setIncludeCallerInfo(boolean includeCallerInfo)
setIncludeCallerData(boolean)
(to use the same name that logback uses)public void setCustomFields(String customFields)
public String getCustomFields()
public LogstashFieldNames getFieldNames()
public void setFieldNames(LogstashFieldNames fieldNames)
public int getShortenedLoggerNameLength()
public void setShortenedLoggerNameLength(int length)
public boolean isIncludeMdc()
public void setIncludeMdc(boolean includeMdc)
public void addIncludeMdcKeyName(String includedMdcKeyName)
public void addExcludeMdcKeyName(String excludedMdcKeyName)
public boolean isIncludeContext()
public void setIncludeContext(boolean includeContext)
@Deprecated public void setEnableContextMap(boolean enableContextMap)
Markers.appendEntries(Map)
marker instead.If set to true the encoder will search logging event array and if the last item is a Map, entries will be included in the message.
Example:
log.info("Service started in {} seconds", duration / 1000, Collections.singletonMap("duration", duration))Will produce:
{ "@timestamp": "2014-06-04T15:26:14.464+02:00", "message": "Service started in 8 seconds", "level": "INFO", "duration": 8496 ...
enableContextMap
- true
to enable context map@Deprecated public boolean isEnableContextMap()
Markers.appendEntries(Map)
marker instead.public ch.qos.logback.classic.pattern.ThrowableHandlingConverter getThrowableConverter()
public void setThrowableConverter(ch.qos.logback.classic.pattern.ThrowableHandlingConverter throwableConverter)
public String getTimeZone()
public void setTimeZone(String timeZoneId)
public int getVersion()
public void setVersion(int version)
public boolean isWriteVersionAsString()
public void setWriteVersionAsString(boolean writeVersionAsString)
Copyright © 2016. All Rights Reserved.