public class LogstashEncoder
extends ch.qos.logback.core.encoder.EncoderBase<ch.qos.logback.classic.spi.ILoggingEvent>
| Constructor and Description |
|---|
LogstashEncoder() |
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, getDeclaredOrigin, getStatusManager, setContextpublic void doEncode(ch.qos.logback.classic.spi.ILoggingEvent event)
throws IOException
IOExceptionpublic void start()
start in interface ch.qos.logback.core.spi.LifeCyclestart in class ch.qos.logback.core.encoder.EncoderBase<ch.qos.logback.classic.spi.ILoggingEvent>public void stop()
stop in interface ch.qos.logback.core.spi.LifeCyclestop in class ch.qos.logback.core.encoder.EncoderBase<ch.qos.logback.classic.spi.ILoggingEvent>public void close()
throws IOException
IOExceptionpublic boolean isImmediateFlush()
public void setImmediateFlush(boolean immediateFlush)
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 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 JsonFactoryDecorator getJsonFactoryDecorator()
public void setJsonFactoryDecorator(JsonFactoryDecorator jsonFactoryDecorator)
public JsonGeneratorDecorator getJsonGeneratorDecorator()
public void setJsonGeneratorDecorator(JsonGeneratorDecorator jsonGeneratorDecorator)
protected LogstashFormatter getFormatter()
Copyright © 2014. All Rights Reserved.