Package net.logstash.logback.composite
Class ContextJsonProvider<Event extends DeferredProcessingAware>
java.lang.Object
ch.qos.logback.core.spi.ContextAwareBase
net.logstash.logback.composite.AbstractJsonProvider<Event>
net.logstash.logback.composite.AbstractFieldJsonProvider<Event>
net.logstash.logback.composite.ContextJsonProvider<Event>
- Type Parameters:
Event
- type of event (ILoggingEvent
orIAccessEvent
).
- All Implemented Interfaces:
ContextAware
,FieldNamesAware<LogstashCommonFieldNames>
,JsonProvider<Event>
public class ContextJsonProvider<Event extends DeferredProcessingAware>
extends AbstractFieldJsonProvider<Event>
implements FieldNamesAware<LogstashCommonFieldNames>
Writes properties from the
Context
into the JSON event.
If the fieldName is set, then the properties will be written
to that field as a subobject.
Otherwise, the properties are written inline.-
Field Summary
Fields inherited from class ch.qos.logback.core.spi.ContextAwareBase
context
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
setFieldNames
(LogstashCommonFieldNames fieldNames) void
writeTo
(JsonGenerator generator, Event event) Writes information about the event, to the given generator.Methods inherited from class net.logstash.logback.composite.AbstractFieldJsonProvider
getFieldName, setFieldName
Methods inherited from class net.logstash.logback.composite.AbstractJsonProvider
assertIsStarted, isStarted, prepareForDeferredProcessing, start, stop
Methods inherited from class ch.qos.logback.core.spi.ContextAwareBase
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, getDeclaredOrigin, getStatusManager, setContext
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface ch.qos.logback.core.spi.ContextAware
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, setContext
-
Constructor Details
-
ContextJsonProvider
public ContextJsonProvider()
-
-
Method Details
-
writeTo
Description copied from interface:JsonProvider
Writes information about the event, to the given generator.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.
- Specified by:
writeTo
in interfaceJsonProvider<Event extends DeferredProcessingAware>
- Parameters:
generator
- theJsonGenerator
to produce JSON contentevent
- the event to convert into JSON- Throws:
IOException
- if an I/O error occurs
-
setFieldNames
- Specified by:
setFieldNames
in interfaceFieldNamesAware<Event extends DeferredProcessingAware>
-