Event
- type of event (ILoggingEvent
or IAccessEvent
).public abstract class AbstractCompositeJsonFormatter<Event extends DeferredProcessingAware> extends ContextAwareBase implements LifeCycle
JsonProvider
s.
The AbstractCompositeJsonFormatter
starts the JSON object ('{'),
then delegates writing the contents of the object to the JsonProvider
s,
and then ends the JSON object ('}').
Jackson JsonGenerator
are initially created with a "disconnected" output stream so they can be
reused multiple times with different target output stream.
JsonGenerator
instances are *not* reused after they threw an exception. This is to prevent
reusing an instance whose internal state may be unpredictable.
context
Constructor and Description |
---|
AbstractCompositeJsonFormatter(ContextAware declaredOrigin) |
Modifier and Type | Method and Description |
---|---|
String |
getEncoding() |
JsonFactory |
getJsonFactory() |
JsonFactoryDecorator |
getJsonFactoryDecorator() |
JsonGeneratorDecorator |
getJsonGeneratorDecorator() |
JsonProviders<Event> |
getProviders() |
boolean |
isFindAndRegisterJacksonModules() |
boolean |
isStarted() |
protected void |
prepareForDeferredProcessing(Event event) |
void |
setEncoding(String encodingName) |
void |
setFindAndRegisterJacksonModules(boolean findAndRegisterJacksonModules) |
void |
setJsonFactoryDecorator(JsonFactoryDecorator jsonFactoryDecorator) |
void |
setJsonGeneratorDecorator(JsonGeneratorDecorator jsonGeneratorDecorator) |
void |
setProviders(JsonProviders<Event> jsonProviders) |
void |
start() |
void |
stop() |
void |
writeEvent(Event event,
OutputStream outputStream)
Write an event in the given output stream.
|
protected void |
writeEventToGenerator(JsonGenerator generator,
Event event) |
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, getDeclaredOrigin, getStatusManager, setContext
public AbstractCompositeJsonFormatter(ContextAware declaredOrigin)
public void writeEvent(Event event, OutputStream outputStream) throws IOException
event
- the event to writeoutputStream
- the output stream to write the event intoIOException
- thrown upon failure to write the eventprotected void writeEventToGenerator(JsonGenerator generator, Event event) throws IOException
IOException
protected void prepareForDeferredProcessing(Event event)
public JsonFactory getJsonFactory()
public JsonFactoryDecorator getJsonFactoryDecorator()
public void setJsonFactoryDecorator(JsonFactoryDecorator jsonFactoryDecorator)
public JsonGeneratorDecorator getJsonGeneratorDecorator()
public void setJsonGeneratorDecorator(JsonGeneratorDecorator jsonGeneratorDecorator)
public JsonProviders<Event> getProviders()
public String getEncoding()
public void setEncoding(String encodingName)
public void setProviders(JsonProviders<Event> jsonProviders)
public boolean isFindAndRegisterJacksonModules()
public void setFindAndRegisterJacksonModules(boolean findAndRegisterJacksonModules)
Copyright © 2013–2021. All rights reserved.