Class JsonThrowablePatternConverter

java.lang.Object
org.apache.logging.log4j.core.pattern.AbstractPatternConverter
org.apache.logging.log4j.core.pattern.LogEventPatternConverter
org.apache.logging.log4j.core.pattern.ThrowablePatternConverter
org.elasticsearch.common.logging.JsonThrowablePatternConverter
All Implemented Interfaces:
org.apache.logging.log4j.core.pattern.PatternConverter

@Plugin(name="JsonThrowablePatternConverter",
        category="Converter")
public final class JsonThrowablePatternConverter
extends org.apache.logging.log4j.core.pattern.ThrowablePatternConverter
Outputs the Throwable portion of the LoggingEvent as a Json formatted field with array "exception": [ "stacktrace", "lines", "as", "array", "elements" ] Reusing @link org.apache.logging.log4j.core.pattern.ExtendedThrowablePatternConverter which already converts a Throwable from LoggingEvent into a multiline string
  • Field Summary

    Fields inherited from class org.apache.logging.log4j.core.pattern.ThrowablePatternConverter

    formatters, options

    Fields inherited from class org.apache.logging.log4j.core.pattern.AbstractPatternConverter

    LOGGER

    Fields inherited from interface org.apache.logging.log4j.core.pattern.PatternConverter

    CATEGORY
  • Method Summary

    Modifier and Type Method Description
    void format​(org.apache.logging.log4j.core.LogEvent event, java.lang.StringBuilder toAppendTo)
    boolean handlesThrowable()  
    static JsonThrowablePatternConverter newInstance​(org.apache.logging.log4j.core.config.Configuration config, java.lang.String[] options)
    Gets an instance of the class.

    Methods inherited from class org.apache.logging.log4j.core.pattern.ThrowablePatternConverter

    getOptions, getSuffix

    Methods inherited from class org.apache.logging.log4j.core.pattern.LogEventPatternConverter

    format, isVariable

    Methods inherited from class org.apache.logging.log4j.core.pattern.AbstractPatternConverter

    getName, getStyleClass

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • newInstance

      public static JsonThrowablePatternConverter newInstance​(org.apache.logging.log4j.core.config.Configuration config, java.lang.String[] options)
      Gets an instance of the class.
      Parameters:
      config - The current Configuration.
      options - pattern options, may be null. If first element is "short", only the first line of the throwable will be formatted.
      Returns:
      instance of class.
    • format

      public void format​(org.apache.logging.log4j.core.LogEvent event, java.lang.StringBuilder toAppendTo)
      Overrides:
      format in class org.apache.logging.log4j.core.pattern.ThrowablePatternConverter
    • handlesThrowable

      public boolean handlesThrowable()
      Overrides:
      handlesThrowable in class org.apache.logging.log4j.core.pattern.ThrowablePatternConverter