public abstract class Formatter extends Object
Formatter objects are used to format LogRecord objects into a
string representation. Head and tail strings are sometimes used to wrap a set
of records. The getHead and getTail methods are used for this
purpose.| Modifier | Constructor and Description |
|---|---|
protected |
Formatter()
Constructs a
Formatter object. |
| Modifier and Type | Method and Description |
|---|---|
abstract String |
format(LogRecord r)
Converts a
LogRecord object into a string representation. |
String |
formatMessage(LogRecord r)
Formats a
LogRecord object into a localized string
representation. |
String |
getHead(Handler h)
Gets the head string used to wrap a set of log records.
|
String |
getTail(Handler h)
Gets the tail string used to wrap a set of log records.
|
public abstract String format(LogRecord r)
LogRecord object into a string representation. The
resulted string is usually localized and includes the message field of
the record.r - the log record to be formatted into a string.public String formatMessage(LogRecord r)
LogRecord object into a localized string
representation. This is a convenience method for subclasses of Formatter.
The message string is firstly localized using the ResourceBundle
object associated with the supplied LogRecord.
Notice : if message contains "{0", then java.text.MessageFormat is used. Otherwise no formatting is performed.
r - the log record to be formatted.public String getHead(Handler h)
h - the target handler.