java.lang.Object | +--java.util.logging.Formatter
Formatter() Constructs a new Formatter. |
java.lang.String | format(java.util.logging.LogRecord record) Formats a LogRecord into a string. |
java.lang.String | formatMessage(java.util.logging.LogRecord record) Formats the message part of a log record. |
java.lang.String | getHead(java.util.logging.Handler handler) Returns a string that handlers are supposed to emit before the first log record. |
java.lang.String | getTail(java.util.logging.Handler handler) Returns a string that handlers are supposed to emit after the last log record. |
protected Formatter()
public String format(java.util.logging.LogRecord record)
record
- the log record for which a string form is requested.public String formatMessage(java.util.logging.LogRecord record)
First, the Formatter localizes the record message to the default locale by looking up the message in the record's localization resource bundle. If this step fails because there is no resource bundle associated with the record, or because the record message is not a key in the bundle, the raw message is used instead.
Second, the Formatter substitutes appropriate strings for
the message parameters. If the record returns a non-empty
array for getParameters()
and the localized
message string contains the character sequence "{0", the
formatter uses java.text.MessageFormat
to format
the message. Otherwise, no parameter substitution is performed.
record
- the log record to be localized and formatted.NullPointerException
- if record
is null
.public String getHead(java.util.logging.Handler handler)
handler
- the handler which will prepend the returned
string in front of the first log record.public String getTail(java.util.logging.Handler handler)
handler
- the handler which will append the returned
string after the last log record.
Formatter
supports handlers by localizing message texts and by subsituting parameter values for their placeholders.