public class LocalizedMessage extends Objectimplements Message , LoggerNameAwareMessage
The recommended way to localize messages is to log a message id. Log events should then be recorded without formatting into a data store. The application that is used to read the events and display them to the user can then localize and format the messages for the end user.
| Modifier and Type | Method and Description |
|---|---|
String |
getFormat()
Gets the format portion of the Message.
|
String |
getFormattedMessage()
Returns the formatted message after looking up the format in the resource bundle.
|
String |
getLoggerName()
Returns the name of the Logger.
|
Object |
getParameters()
Gets parameter values, if any.
|
protected ResourceBundle |
getResourceBundle(String
Override this to use a ResourceBundle.Control in Java 6
|
Throwable |
getThrowable()
Gets the throwable, if any.
|
void |
setLoggerName(String
Set the name of the Logger.
|
public LocalizedMessage(StringmessagePattern, Object [] arguments)
messagePattern - the message pattern that to be checked for placeholders.
arguments - the argument array to be converted.
public LocalizedMessage(ResourceBundlebundle, String key, Object [] arguments)
public LocalizedMessage(StringbaseName, Locale locale, String key, Object [] arguments)
public LocalizedMessage(ResourceBundlebundle, Locale locale, String key, Object [] arguments)
public LocalizedMessage(ResourceBundlebundle, String key, Object arg)
public LocalizedMessage(ResourceBundlebundle, Locale locale, String key, Object arg)
public LocalizedMessage(ResourceBundlebundle, String key, Object arg1, Object arg2)
public LocalizedMessage(StringbaseName, Locale locale, String key, Object arg1, Object arg2)
public LocalizedMessage(ResourceBundlebundle, Locale locale, String key, Object arg1, Object arg2)
public void setLoggerName(Stringname)
setLoggerName in interface
LoggerNameAwareMessage
name - The name of the Logger.
public StringgetLoggerName()
getLoggerName in interface
LoggerNameAwareMessage
public StringgetFormattedMessage()
getFormattedMessage in interface
Message
public StringgetFormat()
Message
getFormat in interface
Message
public Object[] getParameters()
Message
getParameters in interface
Message
public ThrowablegetThrowable()
Message
getThrowable in interface
Message
protected ResourceBundlegetResourceBundle(String rbBaseName, Locale resourceBundleLocale, boolean loop)
rbBaseName - The base name of the resource bundle, a fully qualified class name.
resourceBundleLocale - The locale to use when formatting the message.
loop - If true the key will be treated as a package or class name and a resource bundle will be located based on all or part of the package name. If false the key is expected to be the exact bundle id.