Top Description Inners Constructors Methods
org.jboss.logmanager

public abstract Class ExtFormatter

extends Formatter
Class Inheritance
Known Direct Subclasses
org.jboss.logmanager.ExtFormatter.WrappedFormatter, org.jboss.logmanager.ExtFormatter.Delegating, org.jboss.logmanager.formatters.MultistepFormatter, org.jboss.logmanager.formatters.StructuredFormatter
Imports
java.text.MessageFormat, java.util.MissingResourceException, .Objects, .ResourceBundle, java.util.logging.Formatter, .Handler, .LogRecord

A formatter which handles ExtLogRecord instances.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public abstract static class
ExtFormatter.Delegating

A base class for formatters which wrap other formatters.

pack-priv static class

Constructor Summary

AccessConstructor and Description
public
ExtFormatter()

Construct a new instance.

Method Summary

Modifier and TypeMethod and Description
public final String
format(final LogRecord
the log record to be formatted.
record
)

Implements abstract java.util.logging.Formatter.format.

Format the given log record and return the formatted string.

public abstract String

Returns:

the formatted message
format
(ExtLogRecord
the log record
record
)

Format a message using an extended log record.

public String
formatMessage(LogRecord
the log record containing the raw message
record
)

Overrides java.util.logging.Formatter.formatMessage.

Localize and format the message string from a log record.

protected String

Returns:

the formatted string
formatMessageLegacy
(LogRecord
the record to format
record
)

Format the message text as if there are no parameters.

protected String

Returns:

the formatted string
formatMessageNone
(LogRecord
the record to format
record
)

Format the message text as if there are no parameters.

protected String

Returns:

the formatted string
formatMessagePrintf
(LogRecord
the record to format
record
)

Format the message text as if there are no parameters.

public boolean

Returns:

true if the formatter will need caller information, otherwise false
isCallerCalculationRequired
()

Determines whether or not this formatter will require caller, source level, information when a log record is formatted.

public static ExtFormatter

Returns:

the extended formatter (not null)
wrap
(Formatter
the formatter to wrap (must not be null)
formatter
,
boolean
true to replace message formatting, false to let the original formatter do it
formatMessages
)

Wrap an existing formatter with an ExtFormatter, optionally replacing message formatting with the default extended message formatting capability.

Inherited from java.util.logging.Formatter:
getHeadgetTail

Constructor Detail

ExtFormatterback to summary
public ExtFormatter()

Construct a new instance.

Method Detail

formatback to summary
public final String format(final LogRecord record)

Implements abstract java.util.logging.Formatter.format.

Doc from java.util.logging.Formatter.format.

Format the given log record and return the formatted string.

The resulting formatted String will normally include a localized and formatted version of the LogRecord's message field. It is recommended to use the Formatter#formatMessage convenience method to localize and format the message field.

Parameters
record:LogRecord

the log record to be formatted.

Returns:String

the formatted log record

formatback to summary
public abstract String format(ExtLogRecord record)

Format a message using an extended log record.

Parameters
record:ExtLogRecord

the log record

Returns:String

the formatted message

formatMessageback to summary
public String formatMessage(LogRecord record)

Overrides java.util.logging.Formatter.formatMessage.

Doc from java.util.logging.Formatter.formatMessage.

Localize and format the message string from a log record. This method is provided as a convenience for Formatter subclasses to use when they are performing formatting.

The message string is first localized to a format string using the record's ResourceBundle. (If there is no ResourceBundle, or if the message key is not found, then the key is used as the format string.) The format String uses java.text style formatting.

  • If there are no parameters, no formatter is used.
  • Otherwise, if the string contains "{<digit>" where <digit> is in [0-9], java.text.MessageFormat is used to format the string.
  • Otherwise no formatting is performed.
Parameters
record:LogRecord

the log record containing the raw message

Returns:String

a localized and formatted message

Annotations
@Override
formatMessageLegacyback to summary
protected String formatMessageLegacy(LogRecord record)

Format the message text as if there are no parameters. The default implementation delegates to MessageFormat.format(record.getMessage(),record.getParameters()).

Parameters
record:LogRecord

the record to format

Returns:String

the formatted string

formatMessageNoneback to summary
protected String formatMessageNone(LogRecord record)

Format the message text as if there are no parameters. The default implementation delegates to record.getMessage().

Parameters
record:LogRecord

the record to format

Returns:String

the formatted string

formatMessagePrintfback to summary
protected String formatMessagePrintf(LogRecord record)

Format the message text as if there are no parameters. The default implementation delegates to String.format(record.getMessage(),record.getParameters()).

Parameters
record:LogRecord

the record to format

Returns:String

the formatted string

isCallerCalculationRequiredback to summary
public boolean isCallerCalculationRequired()

Determines whether or not this formatter will require caller, source level, information when a log record is formatted.

Returns:boolean

true if the formatter will need caller information, otherwise false

See Also
LogRecord#getSourceClassName(), ExtLogRecord#getSourceFileName(), ExtLogRecord#getSourceLineNumber(), LogRecord#getSourceMethodName()
wrapback to summary
public static ExtFormatter wrap(Formatter formatter, boolean formatMessages)

Wrap an existing formatter with an ExtFormatter, optionally replacing message formatting with the default extended message formatting capability.

Parameters
formatter:Formatter

the formatter to wrap (must not be null)

formatMessages:boolean

true to replace message formatting, false to let the original formatter do it

Returns:ExtFormatter

the extended formatter (not null)

org.jboss.logmanager back to summary

public abstract Class ExtFormatter.Delegating

extends ExtFormatter
Class Inheritance
Known Direct Subclasses
org.jboss.logmanager.formatters.TextBannerFormatter

A base class for formatters which wrap other formatters.

Field Summary

Modifier and TypeField and Description
protected final ExtFormatter
delegate

The delegate formatter.

Constructor Summary

AccessConstructor and Description
public
Delegating(final ExtFormatter
the delegate formatter (must not be null)
delegate
)

Construct a new instance.

Method Summary

Modifier and TypeMethod and Description
public String
format(final ExtLogRecord
the log record
record
)

Implements abstract org.jboss.logmanager.ExtFormatter.format.

Format a message using an extended log record.

public String
formatMessage(final LogRecord
the log record containing the raw message
record
)

Overrides org.jboss.logmanager.ExtFormatter.formatMessage.

Localize and format the message string from a log record.

public String
getHead(final Handler
The target handler (can be null)
h
)

Overrides java.util.logging.Formatter.getHead.

Return the header string for a set of formatted records.

public String
getTail(final Handler
The target handler (can be null)
h
)

Overrides java.util.logging.Formatter.getTail.

Return the tail string for a set of formatted records.

public boolean
isCallerCalculationRequired()

Overrides org.jboss.logmanager.ExtFormatter.isCallerCalculationRequired.

Determines whether or not this formatter will require caller, source level, information when a log record is formatted.

Inherited from org.jboss.logmanager.ExtFormatter:
formatformatMessageLegacyformatMessageNoneformatMessagePrintfwrap

Field Detail

delegateback to summary
protected final ExtFormatter delegate

The delegate formatter.

Constructor Detail

Delegatingback to summary
public Delegating(final ExtFormatter delegate)

Construct a new instance.

Parameters
delegate:ExtFormatter

the delegate formatter (must not be null)

Method Detail

formatback to summary
public String format(final ExtLogRecord record)

Implements abstract org.jboss.logmanager.ExtFormatter.format.

Doc from org.jboss.logmanager.ExtFormatter.format.

Format a message using an extended log record.

Parameters
record:ExtLogRecord

the log record

Returns:String

the formatted message

formatMessageback to summary
public String formatMessage(final LogRecord record)

Overrides org.jboss.logmanager.ExtFormatter.formatMessage.

Doc from java.util.logging.Formatter.formatMessage.

Localize and format the message string from a log record. This method is provided as a convenience for Formatter subclasses to use when they are performing formatting.

The message string is first localized to a format string using the record's ResourceBundle. (If there is no ResourceBundle, or if the message key is not found, then the key is used as the format string.) The format String uses java.text style formatting.

  • If there are no parameters, no formatter is used.
  • Otherwise, if the string contains "{<digit>" where <digit> is in [0-9], java.text.MessageFormat is used to format the string.
  • Otherwise no formatting is performed.
Parameters
record:LogRecord

the log record containing the raw message

Returns:String

a localized and formatted message

getHeadback to summary
public String getHead(final Handler h)

Overrides java.util.logging.Formatter.getHead.

Doc from java.util.logging.Formatter.getHead.

Return the header string for a set of formatted records.

This base class returns an empty string, but this may be overridden by subclasses.

Parameters
h:Handler

The target handler (can be null)

Returns:String

header string

getTailback to summary
public String getTail(final Handler h)

Overrides java.util.logging.Formatter.getTail.

Doc from java.util.logging.Formatter.getTail.

Return the tail string for a set of formatted records.

This base class returns an empty string, but this may be overridden by subclasses.

Parameters
h:Handler

The target handler (can be null)

Returns:String

tail string

isCallerCalculationRequiredback to summary
public boolean isCallerCalculationRequired()

Overrides org.jboss.logmanager.ExtFormatter.isCallerCalculationRequired.

Doc from org.jboss.logmanager.ExtFormatter.isCallerCalculationRequired.

Determines whether or not this formatter will require caller, source level, information when a log record is formatted.

Returns:boolean

true if the formatter will need caller information, otherwise false

org.jboss.logmanager back to summary

pack-priv Class ExtFormatter.WrappedFormatter

extends ExtFormatter
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final boolean
private final Formatter

Constructor Summary

AccessConstructor and Description
pack-priv
WrappedFormatter(Formatter formatter, boolean formatMessages)

Method Summary

Modifier and TypeMethod and Description
public String
format(ExtLogRecord
the log record
record
)

Implements abstract org.jboss.logmanager.ExtFormatter.format.

Format a message using an extended log record.

public String
formatMessage(LogRecord
the log record containing the raw message
record
)

Overrides org.jboss.logmanager.ExtFormatter.formatMessage.

Localize and format the message string from a log record.

public String
getHead(Handler
The target handler (can be null)
h
)

Overrides java.util.logging.Formatter.getHead.

Return the header string for a set of formatted records.

public String
getTail(Handler
The target handler (can be null)
h
)

Overrides java.util.logging.Formatter.getTail.

Return the tail string for a set of formatted records.

Inherited from org.jboss.logmanager.ExtFormatter:
formatformatMessageLegacyformatMessageNoneformatMessagePrintfisCallerCalculationRequiredwrap

Field Detail

formatMessagesback to summary
private final boolean formatMessages
formatterback to summary
private final Formatter formatter

Constructor Detail

WrappedFormatterback to summary
pack-priv WrappedFormatter(Formatter formatter, boolean formatMessages)

Method Detail

formatback to summary
public String format(ExtLogRecord record)

Implements abstract org.jboss.logmanager.ExtFormatter.format.

Doc from org.jboss.logmanager.ExtFormatter.format.

Format a message using an extended log record.

Parameters
record:ExtLogRecord

the log record

Returns:String

the formatted message

Annotations
@Override
formatMessageback to summary
public String formatMessage(LogRecord record)

Overrides org.jboss.logmanager.ExtFormatter.formatMessage.

Doc from java.util.logging.Formatter.formatMessage.

Localize and format the message string from a log record. This method is provided as a convenience for Formatter subclasses to use when they are performing formatting.

The message string is first localized to a format string using the record's ResourceBundle. (If there is no ResourceBundle, or if the message key is not found, then the key is used as the format string.) The format String uses java.text style formatting.

  • If there are no parameters, no formatter is used.
  • Otherwise, if the string contains "{<digit>" where <digit> is in [0-9], java.text.MessageFormat is used to format the string.
  • Otherwise no formatting is performed.
Parameters
record:LogRecord

the log record containing the raw message

Returns:String

a localized and formatted message

Annotations
@Override
getHeadback to summary
public String getHead(Handler h)

Overrides java.util.logging.Formatter.getHead.

Doc from java.util.logging.Formatter.getHead.

Return the header string for a set of formatted records.

This base class returns an empty string, but this may be overridden by subclasses.

Parameters
h:Handler

The target handler (can be null)

Returns:String

header string

Annotations
@Override
getTailback to summary
public String getTail(Handler h)

Overrides java.util.logging.Formatter.getTail.

Doc from java.util.logging.Formatter.getTail.

Return the tail string for a set of formatted records.

This base class returns an empty string, but this may be overridden by subclasses.

Parameters
h:Handler

The target handler (can be null)

Returns:String

tail string

Annotations
@Override