public class LocalizedMessage extends Object implements 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 rbBaseName,
Locale resourceBundleLocale,
boolean loop)
Override this to use a ResourceBundle.Control in Java 6
|
Throwable |
getThrowable()
Gets the throwable, if any.
|
void |
setLoggerName(String name)
Set the name of the Logger.
|
String |
toString() |
public LocalizedMessage(String messagePattern, Object[] arguments)
messagePattern
- the message pattern that to be checked for placeholders.arguments
- the argument array to be converted.public LocalizedMessage(String baseName, String key, Object[] arguments)
public LocalizedMessage(ResourceBundle bundle, String key, Object[] arguments)
public LocalizedMessage(String baseName, Locale locale, String key, Object[] arguments)
public LocalizedMessage(ResourceBundle bundle, Locale locale, String key, Object[] arguments)
public LocalizedMessage(Locale locale, String key, Object[] arguments)
public LocalizedMessage(String messagePattern, Object arg)
public LocalizedMessage(String baseName, String key, Object arg)
public LocalizedMessage(ResourceBundle bundle, String key)
public LocalizedMessage(ResourceBundle bundle, String key, Object arg)
public LocalizedMessage(String baseName, Locale locale, String key, Object arg)
public LocalizedMessage(ResourceBundle bundle, Locale locale, String key, Object arg)
public LocalizedMessage(Locale locale, String key, Object arg)
public LocalizedMessage(String messagePattern, Object arg1, Object arg2)
public LocalizedMessage(String baseName, String key, Object arg1, Object arg2)
public LocalizedMessage(ResourceBundle bundle, String key, Object arg1, Object arg2)
public LocalizedMessage(String baseName, Locale locale, String key, Object arg1, Object arg2)
public LocalizedMessage(ResourceBundle bundle, Locale locale, String key, Object arg1, Object arg2)
public LocalizedMessage(Locale locale, String key, Object arg1, Object arg2)
public void setLoggerName(String name)
setLoggerName
in interface LoggerNameAwareMessage
name
- The name of the Logger.public String getLoggerName()
getLoggerName
in interface LoggerNameAwareMessage
public String getFormattedMessage()
getFormattedMessage
in interface Message
public String getFormat()
Message
getFormat
in interface Message
public Object[] getParameters()
Message
getParameters
in interface Message
public Throwable getThrowable()
Message
getThrowable
in interface Message
protected ResourceBundle getResourceBundle(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.Copyright © 1999-1969 The Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.