# Class JsonFormatter

java.lang.Object
java.util.logging.Formatter
org.apache.juli.OneLineFormatter
org.apache.juli.JsonFormatter

public class JsonFormatter extends OneLineFormatter
Provides the same information as the one line format but using JSON formatting. All the information of the LogRecord is included as a one line JSON document, including the full stack trace of the associated exception if any.

The LogRecord is mapped as attributes:

- time: the log record timestamp, with the default format as `yyyy-MM-dd'T'HH:mm:ss.SSSX`
- level: the log level
- thread: the current on which the log occurred
- class: the class from which the log originated
- method: the method from which the log originated
- message: the log message
- throwable: the full stack trace from an exception, if present, represented as an array of string (the message first, then one string per stack trace element prefixed by a whitespace, then moving on to the cause exception if any)

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static class`
  `JsonFormatter.JSONFilter`
  Provides escaping of values so they can be included in a JSON document.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `JsonFormatter()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `format(LogRecord record)`

  ### Methods inherited from class OneLineFormatter

  `addTimestamp, getThreadName, getTimeFormat, resolveThreadName, setTimeFormat`

  ### Methods inherited from class Formatter

  `formatMessage, getHead, getTail`

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### JsonFormatter

    public JsonFormatter()

- ## Method Details

  - ### format

    public String format(LogRecord record)
    Overrides:
      `format` in class `OneLineFormatter`