public class MapEntriesAppendingMarker extends LogstashMarker implements StructuredArgument
Marker OR StructuredArgument that appends entries
from a Map into the logging event output.
When writing to the JSON data (via ArgumentsJsonProvider or LogstashMarkersJsonProvider):
String via String.valueOf(Object), and used as field names.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 }
}
| Modifier and Type | Field and Description |
|---|---|
static String |
MARKER_NAME |
MARKER_NAME_PREFIX| Constructor and Description |
|---|
MapEntriesAppendingMarker(Map<?,?> map) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(org.slf4j.Marker other) |
boolean |
contains(String name) |
boolean |
equals(Object obj) |
String |
getName() |
boolean |
hasChildren()
Deprecated.
|
int |
hashCode() |
boolean |
hasReferences() |
Iterator<org.slf4j.Marker> |
iterator() |
boolean |
remove(org.slf4j.Marker referenceToRemove) |
String |
toStringSelf()
Returns a string representation of this object, without including any references.
|
void |
writeTo(JsonGenerator generator)
Writes the data associated with this marker to the given
JsonGenerator. |
add, and, toString, withclone, finalize, getClass, notify, notifyAll, wait, wait, waittoStringforEach, iterator, spliteratorpublic static final String MARKER_NAME
public MapEntriesAppendingMarker(Map<?,?> map)
public void writeTo(JsonGenerator generator) throws IOException
LogstashMarkerJsonGenerator.writeTo in interface StructuredArgumentwriteTo in class LogstashMarkergenerator - the generator to which to write the output of this marker.IOException - if there was an error writing to the generatorpublic String toStringSelf()
LogstashMarkerSubclasses should override LogstashMarker.toStringSelf() instead of LogstashMarker.toString(),
since LogstashMarker.toString() will automatically include the LogstashMarker.toStringSelf() and references.
toStringSelf in class LogstashMarkerpublic boolean equals(Object obj)
equals in interface org.slf4j.Markerpublic int hashCode()
hashCode in interface org.slf4j.Markerpublic String getName()
getName in interface org.slf4j.Markerpublic boolean hasReferences()
hasReferences in interface org.slf4j.Marker@Deprecated public boolean hasChildren()
hasChildren in interface org.slf4j.Markerpublic Iterator<org.slf4j.Marker> iterator()
iterator in interface org.slf4j.Markerpublic boolean remove(org.slf4j.Marker referenceToRemove)
remove in interface org.slf4j.Markerpublic boolean contains(org.slf4j.Marker other)
contains in interface org.slf4j.Markerpublic boolean contains(String name)
contains in interface org.slf4j.MarkerCopyright © 2013–2022. All rights reserved.