Package org.apache.logging.log4j.message
Enum MapMessageJsonFormatter
- All Implemented Interfaces:
Serializable
,Comparable<MapMessageJsonFormatter>
,java.lang.constant.Constable
The default JSON formatter for
MapMessage
s.
The following types have specific handlers:
Map
Collection
(List
,Set
, etc.)Number
(BigDecimal
,Double
,Long
,Byte
, etc.)Boolean
StringBuilderFormattable
- char/boolean/byte/short/int/long/float/double/Object arrays
String
It supports nesting up to a maximum depth of 8, which is set by log4j2.mapMessage.jsonFormatter.maxDepth property.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static void
format
(StringBuilder sb, Object object) private static void
format
(StringBuilder sb, Object object, int depth) private static void
formatBoolean
(StringBuilder sb, boolean booleanValue) private static void
formatBooleanArray
(StringBuilder sb, boolean[] items) private static void
formatByteArray
(StringBuilder sb, byte[] items) private static void
formatCharArray
(StringBuilder sb, char[] items) private static void
formatCollection
(StringBuilder sb, Collection<Object> items, int depth) private static void
formatDoubleArray
(StringBuilder sb, double[] items) private static void
formatFloatArray
(StringBuilder sb, float[] items) private static void
formatFormattable
(StringBuilder sb, StringBuilderFormattable formattable) private static void
formatIndexedStringMap
(StringBuilder sb, IndexedStringMap map, int depth) private static void
formatIntArray
(StringBuilder sb, int[] items) private static void
formatList
(StringBuilder sb, List<Object> items, int depth) private static void
formatLongArray
(StringBuilder sb, long[] items) private static void
formatMap
(StringBuilder sb, Map<Object, Object> map, int depth) private static void
formatNumber
(StringBuilder sb, Number number) private static void
formatObjectArray
(StringBuilder sb, Object[] items, int depth) private static void
formatShortArray
(StringBuilder sb, short[] items) private static void
formatString
(StringBuilder sb, Object value) private static int
static MapMessageJsonFormatter
Returns the enum constant of this type with the specified name.static MapMessageJsonFormatter[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
Field Details
-
MAX_DEPTH
public static final int MAX_DEPTH -
DQUOTE
private static final char DQUOTE- See Also:
-
RBRACE
private static final char RBRACE- See Also:
-
LBRACE
private static final char LBRACE- See Also:
-
COMMA
private static final char COMMA- See Also:
-
RCURLY
private static final char RCURLY- See Also:
-
LCURLY
private static final char LCURLY- See Also:
-
COLON
private static final char COLON- See Also:
-
-
Constructor Details
-
MapMessageJsonFormatter
private MapMessageJsonFormatter()
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
readMaxDepth
private static int readMaxDepth() -
format
-
format
-
formatIndexedStringMap
-
formatMap
-
formatList
-
formatCollection
-
formatNumber
-
formatBoolean
-
formatFormattable
-
formatCharArray
-
formatBooleanArray
-
formatByteArray
-
formatShortArray
-
formatIntArray
-
formatLongArray
-
formatFloatArray
-
formatDoubleArray
-
formatObjectArray
-
formatString
-