Package org.apache.juli
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)
- time: the log record timestamp, with the default format as
-
-
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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
format(java.util.logging.LogRecord record)
-
Methods inherited from class org.apache.juli.OneLineFormatter
addTimestamp, getThreadName, getTimeFormat, setTimeFormat
-
-
-
-
Method Detail
-
format
public java.lang.String format(java.util.logging.LogRecord record)
- Overrides:
format
in classOneLineFormatter
-
-