Class LogstashMarker
java.lang.Object
net.logstash.logback.marker.LogstashMarker
- All Implemented Interfaces:
Serializable, Iterable<org.slf4j.Marker>, org.slf4j.Marker
- Direct Known Subclasses:
DeferredLogstashMarker, EmptyLogstashMarker, MapEntriesAppendingMarker, ObjectFieldsAppendingMarker, SingleFieldAppendingMarker
A
Marker that is known and understood by the logstash logback encoder.
In particular these markers are used to write data into the logstash json event via writeTo(JsonGenerator).
- See Also:
-
Field Summary
FieldsFields inherited from interface org.slf4j.Marker
ANY_MARKER, ANY_NON_NULL_MARKER -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(org.slf4j.Marker reference) <T extends LogstashMarker>
Tand(org.slf4j.Marker reference) Adds the given marker as a reference, and returns this marker.booleanbooleancontains(org.slf4j.Marker other) booleangetName()booleanDeprecated.inthashCode()booleanIterator<org.slf4j.Marker> iterator()booleanremove(org.slf4j.Marker referenceToRemove) toString()Returns a String in the form ofprotected StringReturns a string representation of this object, without including any references.<T extends LogstashMarker>
Twith(org.slf4j.Marker reference) Deprecated.abstract voidwriteTo(JsonGenerator generator) Writes the data associated with this marker to the givenJsonGenerator.Methods inherited from interface Iterable
forEach, iterator, spliterator
-
Field Details
-
MARKER_NAME_PREFIX
- See Also:
-
-
Constructor Details
-
LogstashMarker
-
-
Method Details
-
and
Adds the given marker as a reference, and returns this marker.This can be used to chain markers together fluently on a log line. For example:
import static net.logstash.logback.marker.Markers.* logger.info(append("name1", "value1).and(append("name2", "value2")), "log message");- Type Parameters:
T- subtype of LogstashMarker- Parameters:
reference- The marker to add- Returns:
- A marker with this marker and the given marker
-
with
Deprecated.Useand(Marker)instead- Type Parameters:
T- subtype of LogstashMarker- Parameters:
reference- The marker to add- Returns:
- A marker with this marker and the given marker
- See Also:
-
writeTo
Writes the data associated with this marker to the givenJsonGenerator.- Parameters:
generator- the generator to which to write the output of this marker.
-
add
public void add(org.slf4j.Marker reference) - Specified by:
addin interfaceorg.slf4j.Marker
-
toString
Returns a String in the form ofself, reference1, reference2, ...Where
selfis the value returned bytoStringSelf(), andreference*are thetoString()values of any references.It is recommended that subclasses only override
toStringSelf(), so that references are automatically included in the value returned fromtoString().- Returns:
- a string representation of the object, which includes references
-
toStringSelf
Returns a string representation of this object, without including any references.Subclasses should override
toStringSelf()instead oftoString(), sincetoString()will automatically include thetoStringSelf()and references.- Returns:
- a string representation of this object, without including any references.
-
getName
- Specified by:
getNamein interfaceorg.slf4j.Marker
-
hasReferences
public boolean hasReferences()- Specified by:
hasReferencesin interfaceorg.slf4j.Marker
-
hasChildren
Deprecated.- Specified by:
hasChildrenin interfaceorg.slf4j.Marker
-
iterator
- Specified by:
iteratorin interfaceorg.slf4j.Marker
-
remove
public boolean remove(org.slf4j.Marker referenceToRemove) - Specified by:
removein interfaceorg.slf4j.Marker
-
contains
public boolean contains(org.slf4j.Marker other) - Specified by:
containsin interfaceorg.slf4j.Marker
-
contains
- Specified by:
containsin interfaceorg.slf4j.Marker
-
equals
-
hashCode
-
and(Marker)instead