Event
- type of event (ILoggingEvent
or IAccessEvent
).public abstract class AbstractPatternJsonProvider<Event extends DeferredProcessingAware> extends AbstractJsonProvider<Event> implements JsonFactoryAware
AbstractJsonPatternParser
that is to
parse the pattern specified.
Subclasses must implement createParser(JsonFactory)
method so it returns parser valid for a specified event class.context
Constructor and Description |
---|
AbstractPatternJsonProvider() |
Modifier and Type | Method and Description |
---|---|
protected abstract AbstractJsonPatternParser<Event> |
createParser(JsonFactory jsonFactory) |
String |
getPattern() |
boolean |
isOmitEmptyFields()
When
true , fields whose values are considered empty will be omitted from JSON output. |
void |
setJsonFactory(JsonFactory jsonFactory) |
void |
setOmitEmptyFields(boolean omitEmptyFields)
When
true , fields whose values are considered empty will be omitted from JSON output. |
void |
setPattern(String pattern) |
void |
start()
Start the provider after all configuration properties are set.
|
void |
writeTo(JsonGenerator generator,
Event event)
Writes information about the event, to the given generator.
|
isStarted, prepareForDeferredProcessing, stop
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
public void writeTo(JsonGenerator generator, Event event) throws IOException
JsonProvider
When called, the generator is assumed to be within a JSON object context (i.e. this provider should write fields and their values to the generator). Upon return, the generator should be within the same JSON object context.
writeTo
in interface JsonProvider<Event extends DeferredProcessingAware>
generator
- the JsonGenerator
to produce JSON contentevent
- the event to convert into JSONIOException
- if an I/O error occursprotected abstract AbstractJsonPatternParser<Event> createParser(JsonFactory jsonFactory)
public String getPattern()
public void setPattern(String pattern)
public void setJsonFactory(JsonFactory jsonFactory)
setJsonFactory
in interface JsonFactoryAware
public void start()
JsonProvider
start
in interface JsonProvider<Event extends DeferredProcessingAware>
start
in class AbstractJsonProvider<Event extends DeferredProcessingAware>
public boolean isOmitEmptyFields()
true
, fields whose values are considered empty will be omitted from JSON output.true
if empty fields are omitted from JSON output, false
otherwise.public void setOmitEmptyFields(boolean omitEmptyFields)
true
, fields whose values are considered empty will be omitted from JSON output.omitEmptyFields
- whether empty fields are omitted or notCopyright © 2013–2022. All rights reserved.