Class 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)