public class LogstashAccessFormatter extends Object
Modifier and Type | Field and Description |
---|---|
protected ch.qos.logback.core.spi.ContextAware |
contextAware |
protected FieldNamesType |
fieldNames
The field names to use when writing the standard event fields
|
protected org.apache.commons.lang.time.FastDateFormat |
isoDateTimeTimeZoneFormatWithMillis
Used to format timestamps.
|
Constructor and Description |
---|
LogstashAccessFormatter(ch.qos.logback.core.spi.ContextAware contextAware) |
Modifier and Type | Method and Description |
---|---|
FieldNamesType |
getFieldNames() |
com.fasterxml.jackson.core.JsonFactory |
getJsonFactory() |
JsonFactoryDecorator |
getJsonFactoryDecorator() |
JsonGeneratorDecorator |
getJsonGeneratorDecorator() |
String |
getTimeZone() |
boolean |
isStarted() |
void |
setFieldNames(FieldNamesType fieldNames) |
void |
setJsonFactoryDecorator(JsonFactoryDecorator jsonFactoryDecorator) |
void |
setJsonGeneratorDecorator(JsonGeneratorDecorator jsonGeneratorDecorator) |
void |
setTimeZone(String timeZoneId) |
void |
start() |
void |
stop() |
protected void |
writeMapEntries(com.fasterxml.jackson.core.JsonGenerator generator,
Map<?,?> map) |
protected void |
writeMapStringFields(com.fasterxml.jackson.core.JsonGenerator generator,
String fieldName,
Map<String,String> map)
Writes a map as String fields to the generator if and only if the fieldName and values are not null.
|
protected void |
writeNumberField(com.fasterxml.jackson.core.JsonGenerator generator,
String fieldName,
int fieldValue)
Writes the field to the generator if and only if the fieldName is not null.
|
protected void |
writeNumberField(com.fasterxml.jackson.core.JsonGenerator generator,
String fieldName,
long fieldValue)
Writes the field to the generator if and only if the fieldName is not null.
|
protected void |
writeStringField(com.fasterxml.jackson.core.JsonGenerator generator,
String fieldName,
String fieldValue)
Writes the field to the generator if and only if the fieldName and fieldValue are not null.
|
byte[] |
writeValueAsBytes(EventType event,
ch.qos.logback.core.Context context) |
String |
writeValueAsString(EventType event,
ch.qos.logback.core.Context context) |
protected void |
writeValueToGenerator(com.fasterxml.jackson.core.JsonGenerator generator,
ch.qos.logback.access.spi.IAccessEvent event,
ch.qos.logback.core.Context context) |
void |
writeValueToOutputStream(EventType event,
ch.qos.logback.core.Context context,
OutputStream outputStream) |
protected FieldNamesType extends LogstashCommonFieldNames fieldNames
protected org.apache.commons.lang.time.FastDateFormat isoDateTimeTimeZoneFormatWithMillis
protected final ch.qos.logback.core.spi.ContextAware contextAware
public LogstashAccessFormatter(ch.qos.logback.core.spi.ContextAware contextAware)
protected void writeValueToGenerator(com.fasterxml.jackson.core.JsonGenerator generator, ch.qos.logback.access.spi.IAccessEvent event, ch.qos.logback.core.Context context) throws IOException
IOException
public void start()
start
in interface ch.qos.logback.core.spi.LifeCycle
public void stop()
stop
in interface ch.qos.logback.core.spi.LifeCycle
public boolean isStarted()
isStarted
in interface ch.qos.logback.core.spi.LifeCycle
public com.fasterxml.jackson.core.JsonFactory getJsonFactory()
public byte[] writeValueAsBytes(EventType event, ch.qos.logback.core.Context context) throws IOException
IOException
public void writeValueToOutputStream(EventType event, ch.qos.logback.core.Context context, OutputStream outputStream) throws IOException
IOException
public String writeValueAsString(EventType event, ch.qos.logback.core.Context context) throws IOException
IOException
protected void writeMapEntries(com.fasterxml.jackson.core.JsonGenerator generator, Map<?,?> map) throws IOException, com.fasterxml.jackson.databind.JsonMappingException
IOException
com.fasterxml.jackson.databind.JsonMappingException
protected void writeMapStringFields(com.fasterxml.jackson.core.JsonGenerator generator, String fieldName, Map<String,String> map) throws IOException, com.fasterxml.jackson.databind.JsonMappingException
IOException
com.fasterxml.jackson.databind.JsonMappingException
protected void writeStringField(com.fasterxml.jackson.core.JsonGenerator generator, String fieldName, String fieldValue) throws IOException
IOException
protected void writeNumberField(com.fasterxml.jackson.core.JsonGenerator generator, String fieldName, int fieldValue) throws IOException
IOException
protected void writeNumberField(com.fasterxml.jackson.core.JsonGenerator generator, String fieldName, long fieldValue) throws IOException
IOException
public FieldNamesType getFieldNames()
public void setFieldNames(FieldNamesType fieldNames)
public JsonFactoryDecorator getJsonFactoryDecorator()
public void setJsonFactoryDecorator(JsonFactoryDecorator jsonFactoryDecorator)
public JsonGeneratorDecorator getJsonGeneratorDecorator()
public void setJsonGeneratorDecorator(JsonGeneratorDecorator jsonGeneratorDecorator)
public String getTimeZone()
public void setTimeZone(String timeZoneId)
Copyright © 2015. All Rights Reserved.