Package net.logstash.logback.marker
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
Fields inherited from interface org.slf4j.Marker
ANY_MARKER, ANY_NON_NULL_MARKER
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(org.slf4j.Marker reference) <T extends LogstashMarker>
Tand
(org.slf4j.Marker reference) Adds the given marker as a reference, and returns this marker.boolean
boolean
contains
(org.slf4j.Marker other) boolean
getName()
boolean
Deprecated.int
hashCode()
boolean
Iterator<org.slf4j.Marker>
iterator()
boolean
remove
(org.slf4j.Marker referenceToRemove) toString()
Returns a String in the form ofprotected String
Returns a string representation of this object, without including any references.<T extends LogstashMarker>
Twith
(org.slf4j.Marker reference) Deprecated.abstract void
writeTo
(JsonGenerator generator) Writes the data associated with this marker to the givenJsonGenerator
.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.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.- Throws:
IOException
- if there was an error writing to the generator
-
add
public void add(org.slf4j.Marker reference) - Specified by:
add
in interfaceorg.slf4j.Marker
-
toString
Returns a String in the form ofself, reference1, reference2, ...
Where
self
is 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:
getName
in interfaceorg.slf4j.Marker
-
hasReferences
public boolean hasReferences()- Specified by:
hasReferences
in interfaceorg.slf4j.Marker
-
hasChildren
Deprecated.- Specified by:
hasChildren
in interfaceorg.slf4j.Marker
-
iterator
- Specified by:
iterator
in interfaceorg.slf4j.Marker
-
remove
public boolean remove(org.slf4j.Marker referenceToRemove) - Specified by:
remove
in interfaceorg.slf4j.Marker
-
contains
public boolean contains(org.slf4j.Marker other) - Specified by:
contains
in interfaceorg.slf4j.Marker
-
contains
- Specified by:
contains
in interfaceorg.slf4j.Marker
-
equals
-
hashCode
public int hashCode()
-
and(Marker)
instead