- java.lang.Object
-
- java.util.logging.Formatter
-
- org.jboss.logmanager.ExtFormatter
-
- Direct Known Subclasses:
ExtFormatter.Delegating,MultistepFormatter,StructuredFormatter
public abstract class ExtFormatter extends Formatter
A formatter which handlesExtLogRecordinstances.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classExtFormatter.DelegatingA base class for formatters which wrap other formatters.
-
Constructor Summary
Constructors Constructor Description ExtFormatter()Construct a new instance.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Stringformat(LogRecord record)abstract Stringformat(ExtLogRecord record)Format a message using an extended log record.StringformatMessage(LogRecord record)protected StringformatMessageLegacy(LogRecord record)Format the message text as if there are no parameters.protected StringformatMessageNone(LogRecord record)Format the message text as if there are no parameters.protected StringformatMessagePrintf(LogRecord record)Format the message text as if there are no parameters.booleanisCallerCalculationRequired()Determines whether or not this formatter will require caller, source level, information when a log record is formatted.static ExtFormatterwrap(Formatter formatter, boolean formatMessages)Wrap an existing formatter with anExtFormatter, optionally replacing message formatting with the default extended message formatting capability.
-
-
-
Method Detail
-
wrap
public static ExtFormatter wrap(Formatter formatter, boolean formatMessages)
Wrap an existing formatter with anExtFormatter, optionally replacing message formatting with the default extended message formatting capability.- Parameters:
formatter- the formatter to wrap (must not benull)formatMessages-trueto replace message formatting,falseto let the original formatter do it- Returns:
- the extended formatter (not
null)
-
format
public abstract String format(ExtLogRecord record)
Format a message using an extended log record.- Parameters:
record- the log record- Returns:
- the formatted message
-
formatMessage
public String formatMessage(LogRecord record)
- Overrides:
formatMessagein classFormatter
-
isCallerCalculationRequired
public boolean isCallerCalculationRequired()
Determines whether or not this formatter will require caller, source level, information when a log record is formatted.- Returns:
trueif the formatter will need caller information, otherwisefalse- See Also:
LogRecord.getSourceClassName(),ExtLogRecord.getSourceFileName(),ExtLogRecord.getSourceLineNumber(),LogRecord.getSourceMethodName()
-
formatMessageNone
protected String formatMessageNone(LogRecord record)
Format the message text as if there are no parameters. The default implementation delegates torecord.getMessage().- Parameters:
record- the record to format- Returns:
- the formatted string
-
formatMessageLegacy
protected String formatMessageLegacy(LogRecord record)
Format the message text as if there are no parameters. The default implementation delegates toMessageFormat.format(record.getMessage(),record.getParameters()).- Parameters:
record- the record to format- Returns:
- the formatted string
-
formatMessagePrintf
protected String formatMessagePrintf(LogRecord record)
Format the message text as if there are no parameters. The default implementation delegates toString.format(record.getMessage(),record.getParameters()).- Parameters:
record- the record to format- Returns:
- the formatted string
-
-