public abstract class StructuredFormatter
extends org.jboss.logmanager.ExtFormatter
record.
Note that including details can be expensive in terms of calculating the caller.
By default the record delimiter is set to \n.
| Modifier and Type | Class and Description |
|---|---|
static class |
StructuredFormatter.ExceptionOutputType
Defines the way a cause will be formatted.
|
protected static class |
StructuredFormatter.Generator
A generator used to create the structured output.
|
static class |
StructuredFormatter.Key
The key used for the structured log record data.
|
| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_DATE_FORMAT |
| Modifier | Constructor and Description |
|---|---|
protected |
StructuredFormatter() |
protected |
StructuredFormatter(Map<StructuredFormatter.Key,String> keyOverrides) |
protected |
StructuredFormatter(String keyOverrides) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
after(StructuredFormatter.Generator generator,
org.jboss.logmanager.ExtLogRecord record)
Invoked after the structured data has been added to the generator.
|
protected void |
before(StructuredFormatter.Generator generator,
org.jboss.logmanager.ExtLogRecord record)
Invoked before the structured data is added to the generator.
|
protected abstract StructuredFormatter.Generator |
createGenerator(Writer writer)
Creates the generator used to create the structured data.
|
String |
format(org.jboss.logmanager.ExtLogRecord record) |
String |
getDateFormat()
Gets the current date format.
|
StructuredFormatter.ExceptionOutputType |
getExceptionOutputType()
Get the current output type for exceptions.
|
protected String |
getKey(StructuredFormatter.Key defaultKey)
Checks to see if the key should be overridden.
|
String |
getKeyOverrides()
A string representation of the key overrides.
|
String |
getMetaData()
Returns the value set for meta data.
|
String |
getRecordDelimiter()
Returns the character used to indicate the record has is complete.
|
protected boolean |
isDetailedExceptionOutputType()
Checks the exception output type and determines if detailed output should be written.
|
protected boolean |
isFormattedExceptionOutputType()
Checks the exception output type and determines if formatted output should be written.
|
boolean |
isPrintDetails()
Indicates whether or not details should be printed.
|
void |
setDateFormat(String pattern)
Sets the pattern to use when formatting the date.
|
void |
setExceptionOutputType(StructuredFormatter.ExceptionOutputType exceptionOutputType)
Set the output type for exceptions.
|
void |
setMetaData(String metaData)
Sets the meta data to use in the structured format.
|
void |
setPrintDetails(boolean printDetails)
Sets whether or not details should be printed.
|
void |
setRecordDelimiter(String eorDelimiter)
Sets the value to be used to indicate the end of a record.
|
formatMessage, getHead, getTailpublic static final String DEFAULT_DATE_FORMAT
protected StructuredFormatter()
protected StructuredFormatter(Map<StructuredFormatter.Key,String> keyOverrides)
protected StructuredFormatter(String keyOverrides)
protected abstract StructuredFormatter.Generator createGenerator(Writer writer) throws Exception
Exception - if an error occurs creating the generatorprotected void before(StructuredFormatter.Generator generator, org.jboss.logmanager.ExtLogRecord record) throws Exception
generator - the generator to userecord - the log recordExceptionprotected void after(StructuredFormatter.Generator generator, org.jboss.logmanager.ExtLogRecord record) throws Exception
generator - the generator to userecord - the log recordExceptionprotected final String getKey(StructuredFormatter.Key defaultKey)
defaultKey - the default keypublic String format(org.jboss.logmanager.ExtLogRecord record)
format in class org.jboss.logmanager.ExtFormatterpublic String getKeyOverrides()
null.null if no overrides were configuredpublic String getRecordDelimiter()
\n and may be
null if no end of record character is desired.null if no delimiter is desiredpublic void setRecordDelimiter(String eorDelimiter)
null no delimiter will be used at
the end of the record.eorDelimiter - the delimiter to be used or null to not use a delimiterpublic String getMetaData()
The value is a string where key/value pairs are separated by commas. The key and value are separated by an equal sign.
null if one was not setPropertyValues.stringToMap(String)public void setMetaData(String metaData)
The value is a string where key/value pairs are separated by commas. The key and value are separated by an equal sign.
metaData - the meta data to set or null to not format any meta dataPropertyValues.stringToMap(String)public String getDateFormat()
public void setDateFormat(String pattern)
SimpleDateFormat
pattern.
If the pattern is null a default pattern will be used.
pattern - the pattern to usepublic boolean isPrintDetails()
true if details should be printed, otherwise falsepublic void setPrintDetails(boolean printDetails)
Printing the details can be expensive as the values are retrieved from the caller. The details include the source class name, source file name, source method name and source line number.
printDetails - true if details should be printedpublic StructuredFormatter.ExceptionOutputType getExceptionOutputType()
public void setExceptionOutputType(StructuredFormatter.ExceptionOutputType exceptionOutputType)
DETAILED.exceptionOutputType - the desired output type, if null StructuredFormatter.ExceptionOutputType.DETAILED is usedprotected boolean isDetailedExceptionOutputType()
true if detailed output should be written, otherwise falseprotected boolean isFormattedExceptionOutputType()
Throwable.printStackTrace().true if formatted exception output should be written, otherwide falseCopyright © 2018 JBoss by Red Hat. All rights reserved.