public class LogstashEncoder extends LoggingEventCompositeJsonEncoder
started
context
Constructor and Description |
---|
LogstashEncoder() |
setProviders
close, doEncode, doEncode, encode, footerBytes, getEncoding, getJsonFactoryDecorator, getJsonGeneratorDecorator, getLineSeparator, getMinBufferSize, getPrefix, getProviders, getSuffix, headerBytes, init, isImmediateFlush, setEncoding, setFindAndRegisterJacksonModules, setImmediateFlush, setJsonFactoryDecorator, setJsonGeneratorDecorator, setLineSeparator, setLogback11Support, setMinBufferSize, setPrefix, setSuffix, start, stop
isStarted
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, getDeclaredOrigin, getStatusManager, setContext
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, setContext
protected CompositeJsonFormatter<ILoggingEvent> createFormatter()
createFormatter
in class LoggingEventCompositeJsonEncoder
protected LogstashFormatter getFormatter()
getFormatter
in class CompositeJsonEncoder<ILoggingEvent>
public void addProvider(JsonProvider<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 void addMdcKeyFieldName(String mdcKeyFieldName)
public boolean isIncludeTags()
public void setIncludeTags(boolean includeTags)
public boolean isIncludeContext()
public void setIncludeContext(boolean includeContext)
public boolean isIncludeStructuredArguments()
public void setIncludeStructuredArguments(boolean includeStructuredArguments)
public boolean isIncludeNonStructuredArguments()
public void setIncludeNonStructuredArguments(boolean includeNonStructuredArguments)
public String getNonStructuredArgumentsFieldPrefix()
public void setNonStructuredArgumentsFieldPrefix(String nonStructuredArgumentsFieldPrefix)
@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 ThrowableHandlingConverter getThrowableConverter()
public void setThrowableConverter(ThrowableHandlingConverter throwableConverter)
public String getTimeZone()
public void setTimeZone(String timeZoneId)
public String getTimestampPattern()
public void setTimestampPattern(String pattern)
public String getVersion()
public void setVersion(String version)
@Deprecated public boolean isWriteVersionAsString()
isWriteVersionAsInteger()
@Deprecated public void setWriteVersionAsString(boolean writeVersionAsString)
setWriteVersionAsInteger(boolean)
public boolean isWriteVersionAsInteger()
public void setWriteVersionAsInteger(boolean writeVersionAsInteger)
public String getMessageSplitRegex()
public void setMessageSplitRegex(String messageSplitRegex)
The allowed values are:
For example, if this parameter is set to the regex #+
, then the logging statement:
log.info("First line##Second line###Third line")will produce:
{ ... "message": [ "First line", "Second line", "Third line" ], ... }
messageSplitRegex
- The regex used to split the message textCopyright © 2020. All rights reserved.