Package org.jboss.logmanager.formatters
Class JsonFormatter
java.lang.Object
java.util.logging.Formatter
org.jboss.logmanager.ExtFormatter
org.jboss.logmanager.formatters.StructuredFormatter
org.jboss.logmanager.formatters.JsonFormatter
A formatter that outputs the record into JSON format optionally printing details.
Note that including details can be expensive in terms of calculating the caller.
The details include;
- Author:
- James R. Perkins
-
Nested Class Summary
Nested classes/interfaces inherited from class org.jboss.logmanager.formatters.StructuredFormatter
StructuredFormatter.ExceptionOutputType, StructuredFormatter.Generator, StructuredFormatter.Key -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new JSON formatter.JsonFormatter(String keyOverrides) Creates a new JSON formatter.JsonFormatter(Map<StructuredFormatter.Key, String> keyOverrides) Creates a new JSON formatter. -
Method Summary
Modifier and TypeMethodDescriptionprotected StructuredFormatter.GeneratorcreateGenerator(Writer writer) Creates the generator used to create the structured data.booleanIndicates whether or not pretty printing is enabled.voidsetPrettyPrint(boolean prettyPrint) Turns on or off pretty printing.Methods inherited from class org.jboss.logmanager.formatters.StructuredFormatter
after, before, format, getDateTimeFormatter, getExceptionOutputType, getKey, getKeyOverrides, getRecordDelimiter, getZoneId, isCallerCalculationRequired, isDetailedExceptionOutputType, isFormattedExceptionOutputType, isPrintDetails, setDateFormat, setExceptionOutputType, setPrintDetails, setRecordDelimiter, setZoneIdMethods inherited from class org.jboss.logmanager.ExtFormatter
format, formatMessage, formatMessageLegacy, formatMessageNone, formatMessagePrintf
-
Constructor Details
-
JsonFormatter
public JsonFormatter()Creates a new JSON formatter. -
JsonFormatter
Creates a new JSON formatter.- Parameters:
keyOverrides- a string representation of a map to override keys- See Also:
-
JsonFormatter
Creates a new JSON formatter.- Parameters:
keyOverrides- a map of overrides for the default keys
-
-
Method Details
-
isPrettyPrint
public boolean isPrettyPrint()Indicates whether or not pretty printing is enabled.- Returns:
trueif pretty printing is enabled, otherwisefalse
-
setPrettyPrint
public void setPrettyPrint(boolean prettyPrint) Turns on or off pretty printing.- Parameters:
prettyPrint-trueto turn on pretty printing orfalseto turn it off
-
createGenerator
Description copied from class:StructuredFormatterCreates the generator used to create the structured data.- Specified by:
createGeneratorin classStructuredFormatter- Returns:
- the generator to use
-