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() |
boolean |
isEnableContextMap()
Deprecated.
When logging, prefer using a
Markers.appendEntries(Map) marker instead. |
boolean |
isIncludeCallerInfo() |
boolean |
isIncludeContext() |
boolean |
isIncludeMdc() |
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 |
setIncludeCallerInfo(boolean includeCallerInfo) |
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) |
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 isIncludeCallerInfo()
public void setIncludeCallerInfo(boolean includeCallerInfo)
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)
Copyright © 2015. All Rights Reserved.