public class LogstashFormatter extends LoggingEventCompositeJsonFormatter
LoggingEventCompositeJsonFormatter that contains a common
pre-defined set of JsonProviders.
The included providers are configured via properties on this
formatter, rather than configuring the providers directly.
This leads to a somewhat simpler configuration definitions.
You cannot remove any of the pre-defined providers, but
you can add additional providers via addProvider(JsonProvider).
If you would like full control over the providers, you
should instead use LoggingEventCompositeJsonFormatter directly.| Modifier and Type | Field and Description |
|---|---|
protected LogstashFieldNames |
fieldNames
The field names to use when writing the standard event fields
|
context| Constructor and Description |
|---|
LogstashFormatter(ContextAware declaredOrigin) |
LogstashFormatter(ContextAware declaredOrigin,
boolean includeCallerData) |
LogstashFormatter(ContextAware declaredOrigin,
boolean includeCallerData,
JsonNode customFields) |
getEncoding, getJsonFactory, getJsonFactoryDecorator, getJsonGeneratorDecorator, isFindAndRegisterJacksonModules, isStarted, prepareForDeferredProcessing, setEncoding, setFindAndRegisterJacksonModules, setJsonFactoryDecorator, setJsonGeneratorDecorator, stop, writeEvent, writeEventToGeneratoraddError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, getDeclaredOrigin, getStatusManager, setContextprotected LogstashFieldNames fieldNames
public LogstashFormatter(ContextAware declaredOrigin)
public LogstashFormatter(ContextAware declaredOrigin, boolean includeCallerData)
public LogstashFormatter(ContextAware declaredOrigin, boolean includeCallerData, JsonNode customFields)
public void start()
start in interface LifeCyclestart in class AbstractCompositeJsonFormatter<ILoggingEvent>protected void configureProviderFieldNames()
public boolean isIncludeCallerData()
public void setIncludeCallerData(boolean includeCallerData)
public String getCustomFieldsAsString()
public void setCustomFieldsFromString(String customFields)
public void setCustomFields(JsonNode customFields)
public JsonNode getCustomFields()
public int getShortenedLoggerNameLength()
public void setShortenedLoggerNameLength(int length)
public boolean isIncludeMdc()
public void setIncludeMdc(boolean includeMdc)
public boolean isIncludeTags()
public void setIncludeTags(boolean includeTags)
public boolean isIncludeStructuredArguments()
public void setIncludeStructuredArguments(boolean includeStructuredArguments)
public boolean isIncludeNonStructuredArguments()
public void setIncludeNonStructuredArguments(boolean includeNonStructuredArguments)
public String getNonStructuredArgumentsFieldPrefix()
public void setNonStructuredArgumentsFieldPrefix(String nonStructuredArgumentsFieldPrefix)
public void addIncludeMdcKeyName(String includedMdcKeyName)
public void addExcludeMdcKeyName(String excludedMdcKeyName)
public void addMdcKeyFieldName(String mdcKeyFieldName)
public boolean isIncludeContext()
public void setIncludeContext(boolean includeContext)
public ThrowableHandlingConverter getThrowableConverter()
public void setThrowableConverter(ThrowableHandlingConverter throwableConverter)
public String getVersion()
public void setVersion(String version)
public boolean isWriteVersionAsInteger()
public void setWriteVersionAsInteger(boolean writeVersionAsInteger)
public String getMessageSplitRegex()
public void setMessageSplitRegex(String messageSplitRegex)
The allowed values are:
SYSTEM : Use the system-default line separator.UNIX : Use \n.WINDOWS : Use \r\n.#+, 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 textpublic void addProvider(JsonProvider<ILoggingEvent> provider)
public LoggingEventJsonProviders getProviders()
getProviders in class AbstractCompositeJsonFormatter<ILoggingEvent>public LogstashFieldNames getFieldNames()
public void setFieldNames(LogstashFieldNames fieldNames)
public String getTimeZone()
public void setTimeZone(String timeZoneId)
public String getTimestampPattern()
public void setTimestampPattern(String pattern)
public void setProviders(JsonProviders<ILoggingEvent> jsonProviders)
setProviders in class LoggingEventCompositeJsonFormatterCopyright © 2013–2021. All rights reserved.