java.lang.Object
net.logstash.logback.marker.LogstashMarker
net.logstash.logback.marker.MapEntriesAppendingMarker
- All Implemented Interfaces:
Serializable,Iterable<org.slf4j.Marker>,StructuredArgument,org.slf4j.Marker
A
Marker OR StructuredArgument that appends entries
from a Map into the logging event output.
When writing to the JSON data (via ArgumentsJsonProvider or LogstashMarkersJsonProvider):
- Keys are converted to a
StringviaString.valueOf(Object), and used as field names. - Values are converted using an
ObjectMapper.
StructuredArgument to the event's formatted message),
String.valueOf(Object) is used to convert the map to a string.
For example, if the message is "mymessage {}", and map argument contains is
name1= a String "value1",
name2= an Integer 5,
name3= an array containing [1, 2, 3],
name4= a map containing name5=6
Then the message, name1, name2, name3, name4 fields will be added to the json for the logstash event.
For example:
{
"message" : "mymessage [name1=value1,name2=5,name3=[b...,name4=[name5=6]]",
"name1" : "value1",
"name2" : 5,
"name3" : [1, 2, 3],
"name4" : { "name5" : 6 }
}
- See Also:
-
Field Summary
FieldsFields inherited from class net.logstash.logback.marker.LogstashMarker
MARKER_NAME_PREFIXFields inherited from interface org.slf4j.Marker
ANY_MARKER, ANY_NON_NULL_MARKER -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleancontains(org.slf4j.Marker other) booleangetName()booleanDeprecated.inthashCode()booleanIterator<org.slf4j.Marker> iterator()booleanremove(org.slf4j.Marker referenceToRemove) Returns a string representation of this object, without including any references.voidwriteTo(JsonGenerator generator) Writes the data associated with this marker to the givenJsonGenerator.Methods inherited from class net.logstash.logback.marker.LogstashMarker
add, and, toString, withMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, iterator, spliteratorMethods inherited from interface net.logstash.logback.argument.StructuredArgument
toString
-
Field Details
-
MARKER_NAME
- See Also:
-
-
Constructor Details
-
MapEntriesAppendingMarker
-
-
Method Details
-
writeTo
Description copied from class:LogstashMarkerWrites the data associated with this marker to the givenJsonGenerator.- Specified by:
writeToin interfaceStructuredArgument- Specified by:
writeToin classLogstashMarker- Parameters:
generator- the generator to which to write the output of this marker.- Throws:
IOException- if there was an error writing to the generator
-
toStringSelf
Description copied from class:LogstashMarkerReturns a string representation of this object, without including any references.Subclasses should override
LogstashMarker.toStringSelf()instead ofLogstashMarker.toString(), sinceLogstashMarker.toString()will automatically include theLogstashMarker.toStringSelf()and references.- Overrides:
toStringSelfin classLogstashMarker- Returns:
- a string representation of this object, without including any references.
-
equals
- Specified by:
equalsin interfaceorg.slf4j.Marker
-
hashCode
public int hashCode()- Specified by:
hashCodein interfaceorg.slf4j.Marker
-
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
-