Enum MapMessageJsonFormatter

java.lang.Object
java.lang.Enum<MapMessageJsonFormatter>
org.apache.logging.log4j.message.MapMessageJsonFormatter
All Implemented Interfaces:
Serializable, Comparable<MapMessageJsonFormatter>, java.lang.constant.Constable

enum MapMessageJsonFormatter extends Enum<MapMessageJsonFormatter>
The default JSON formatter for MapMessages.

The following types have specific handlers:

It supports nesting up to a maximum depth of 8, which is set by log4j2.mapMessage.jsonFormatter.maxDepth property.

  • Field Details

  • Constructor Details

    • MapMessageJsonFormatter

      private MapMessageJsonFormatter()
  • Method Details

    • values

      public static MapMessageJsonFormatter[] 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

      public static MapMessageJsonFormatter valueOf(String name)
      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 name
      NullPointerException - if the argument is null
    • readMaxDepth

      private static int readMaxDepth()
    • format

      static void format(StringBuilder sb, Object object)
    • format

      private static void format(StringBuilder sb, Object object, int depth)
    • formatIndexedStringMap

      private static void formatIndexedStringMap(StringBuilder sb, IndexedStringMap map, int depth)
    • formatMap

      private static void formatMap(StringBuilder sb, Map<Object,Object> map, int depth)
    • formatList

      private static void formatList(StringBuilder sb, List<Object> items, int depth)
    • formatCollection

      private static void formatCollection(StringBuilder sb, Collection<Object> items, int depth)
    • formatNumber

      private static void formatNumber(StringBuilder sb, Number number)
    • formatBoolean

      private static void formatBoolean(StringBuilder sb, boolean booleanValue)
    • formatFormattable

      private static void formatFormattable(StringBuilder sb, StringBuilderFormattable formattable)
    • formatCharArray

      private static void formatCharArray(StringBuilder sb, char[] items)
    • formatBooleanArray

      private static void formatBooleanArray(StringBuilder sb, boolean[] items)
    • formatByteArray

      private static void formatByteArray(StringBuilder sb, byte[] items)
    • formatShortArray

      private static void formatShortArray(StringBuilder sb, short[] items)
    • formatIntArray

      private static void formatIntArray(StringBuilder sb, int[] items)
    • formatLongArray

      private static void formatLongArray(StringBuilder sb, long[] items)
    • formatFloatArray

      private static void formatFloatArray(StringBuilder sb, float[] items)
    • formatDoubleArray

      private static void formatDoubleArray(StringBuilder sb, double[] items)
    • formatObjectArray

      private static void formatObjectArray(StringBuilder sb, Object[] items, int depth)
    • formatString

      private static void formatString(StringBuilder sb, Object value)