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 appending EOL (\n) is set to true.
| Modifier and Type | Class and Description |
|---|---|
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) |
| 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.
|
protected String |
getKey(StructuredFormatter.Key defaultKey)
Checks to see if the key should be overridden.
|
String |
getMetaData()
Returns the value set for meta data.
|
boolean |
isAppendEndOfLine()
Indicates whether or not an EOL (
\n) character will appended to the formatted message. |
boolean |
isPrintDetails()
Indicates whether or not details should be printed.
|
void |
setAppendEndOfLine(boolean addEolChar)
Set whether or not an EOL (
\n) character will appended to the formatted message. |
void |
setDateFormat(String pattern)
Sets the pattern to use when formatting the date.
|
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.
|
formatMessage, getHead, getTailpublic static final String DEFAULT_DATE_FORMAT
protected StructuredFormatter()
protected StructuredFormatter(Map<StructuredFormatter.Key,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 boolean isAppendEndOfLine()
\n) character will appended to the formatted message.true to append the EOL character, otherwise falsepublic void setAppendEndOfLine(boolean addEolChar)
\n) character will appended to the formatted message.addEolChar - true to append the EOL character, otherwise falsepublic 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 setValueParser.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 dataValueParser.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 printedCopyright © 2015 JBoss by Red Hat. All rights reserved.