com.resilientedge.util.logger
Class Formatter
java.lang.Object
|
+--com.resilientedge.util.logger.Formatter
- Direct Known Subclasses:
- ConsoleFormatter
- public abstract class Formatter
- extends java.lang.Object
A Formatter is used to format log records. Typically, each logging handler
will have a Formatter associated with it. The Formatter takes a LogRecord
and prepares it's message for output.
- Author:
- odh
Method Summary |
abstract void |
format(LogRecord logRecord)
Generate a fully-formatted log message. |
java.lang.String |
format(java.lang.String tokenizedMessage,
java.lang.Object[] insertValues)
This method performs tokenized-string replacements. |
java.util.Locale |
getLocale()
Returns the Formatter's Locale. |
void |
setLocale(java.util.Locale locale)
Set the Formatter's Locale. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Formatter
public Formatter()
setLocale
public void setLocale(java.util.Locale locale)
- Set the Formatter's Locale.
- Parameters:
locale
- the locale the Formatter should use.
getLocale
public java.util.Locale getLocale()
- Returns the Formatter's Locale. If a locale has not been specified, this
method returns a default Locale of: Locale.US
- Returns:
- The current or default locale.
format
public abstract void format(LogRecord logRecord)
- Generate a fully-formatted log message. Subclasses should implement this
method such that the returned LogRecord is completely ready for logging.
- Parameters:
logRecord
- The logRecord containing the information to format.
format
public java.lang.String format(java.lang.String tokenizedMessage,
java.lang.Object[] insertValues)
- This method performs tokenized-string replacements. The toString() method
of objects supplied in the array are used to replace tokens in the
tokenizedMessage string. TokenizedMessage strings must be in the format
used by java.text.MessageFormat's format() method.
(example, "At {1,time} on {1,date}, there was {2} on server number
{0,number,integer}.")
- Parameters:
tokenizedMessage
- String with tokensinsertValues
- object array used for token replacement.- Returns:
- The resulting string after replacement has been
performed.
- See Also:
MessageFormat
Copyright © 2001 Resilient Edge, Inc. All Rights Reserved.