Skip to content

Most visited

Recently visited

navigation
Added in API level 1

Formatter

public abstract class Formatter
extends Object

java.lang.Object
   ↳ java.util.logging.Formatter
Known Direct Subclasses


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.

Summary

Protected constructors

Formatter()

Constructs a Formatter object.

Public methods

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.

Inherited methods

From class java.lang.Object

Protected constructors

Formatter

Added in API level 1
Formatter ()

Constructs a Formatter object.

Public methods

format

Added in API level 1
String format (LogRecord r)

Converts a LogRecord object into a string representation. The resulted string is usually localized and includes the message field of the record.

Parameters
r LogRecord: the log record to be formatted into a string.
Returns
String the formatted string.

formatMessage

Added in API level 1
String formatMessage (LogRecord r)

Formats a 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.

Parameters
r LogRecord: the log record to be formatted.
Returns
String the string resulted from the formatting.

getHead

Added in API level 1
String getHead (Handler h)

Gets the head string used to wrap a set of log records. This base class always returns an empty string.

Parameters
h Handler: the target handler.
Returns
String the head string used to wrap a set of log records, empty in this implementation.

getTail

Added in API level 1
String getTail (Handler h)

Gets the tail string used to wrap a set of log records. This base class always returns the empty string.

Parameters
h Handler: the target handler.
Returns
String the tail string used to wrap a set of log records, empty in this implementation.
This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.