|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.logging.log4j.message.ParameterizedMessage
org.apache.logging.log4j.message.LocalizedMessage
public class LocalizedMessage
This class is not the recommended way to Localize messages. It is provided to provide some level of compatibility with Log4j 1.x. The recommended way to localize messages is to simply log a message id. Log events should then be recorded without formatting into some kind of data store. The application that is used to read the events and display them to the user should also localize and format the messages for the end user.
Field Summary |
---|
Fields inherited from class org.apache.logging.log4j.message.ParameterizedMessage |
---|
ERROR_MSG_SEPARATOR, ERROR_PREFIX, ERROR_SEPARATOR, ERROR_SUFFIX, RECURSION_PREFIX, RECURSION_SUFFIX |
Constructor Summary | |
---|---|
LocalizedMessage()
The basic constructor. |
|
LocalizedMessage(Locale locale,
String key,
Object arg)
|
|
LocalizedMessage(Locale locale,
String key,
Object[] arguments)
|
|
LocalizedMessage(Locale locale,
String key,
Object arg1,
Object arg2)
|
|
LocalizedMessage(Locale locale,
String key,
String[] stringArgs,
Throwable throwable)
|
|
LocalizedMessage(ResourceBundle bundle,
Locale locale,
String key,
Object arg)
|
|
LocalizedMessage(ResourceBundle bundle,
Locale locale,
String key,
Object[] arguments)
|
|
LocalizedMessage(ResourceBundle bundle,
Locale locale,
String key,
Object arg1,
Object arg2)
|
|
LocalizedMessage(ResourceBundle bundle,
Locale locale,
String key,
String[] stringArgs,
Throwable throwable)
|
|
LocalizedMessage(ResourceBundle bundle,
String key,
Object arg)
|
|
LocalizedMessage(ResourceBundle bundle,
String key,
Object[] arguments)
|
|
LocalizedMessage(ResourceBundle bundle,
String key,
Object arg1,
Object arg2)
|
|
LocalizedMessage(ResourceBundle bundle,
String key,
String[] stringArgs,
Throwable throwable)
|
|
LocalizedMessage(String bundleId,
Locale locale,
String key,
Object arg)
|
|
LocalizedMessage(String bundleId,
Locale locale,
String key,
Object[] arguments)
|
|
LocalizedMessage(String bundleId,
Locale locale,
String key,
Object arg1,
Object arg2)
|
|
LocalizedMessage(String bundleId,
Locale locale,
String key,
String[] stringArgs,
Throwable throwable)
|
|
LocalizedMessage(String messagePattern,
Object arg)
|
|
LocalizedMessage(String messagePattern,
Object[] arguments)
This method returns a LocalizedMessage which contains the arguments converted to String as well as an optional Throwable. |
|
LocalizedMessage(String messagePattern,
Object arg1,
Object arg2)
|
|
LocalizedMessage(String messagePattern,
String[] stringArgs,
Throwable throwable)
|
|
LocalizedMessage(String bundleId,
String key,
Object arg)
|
|
LocalizedMessage(String bundleId,
String key,
Object[] arguments)
|
|
LocalizedMessage(String bundleId,
String key,
Object arg1,
Object arg2)
|
|
LocalizedMessage(String bundleId,
String key,
String[] stringArgs,
Throwable throwable)
|
Method Summary | |
---|---|
String |
formatMessage(String messagePattern,
String[] args)
Return the formatted message after looking up the format in the resource bundle. |
protected ResourceBundle |
getBundle(String key,
Locale locale,
boolean loop)
Override this to use a ResourceBundle.Control in Java 6 |
String |
getLoggerName()
Return the name of the Logger. |
void |
setLoggerName(String name)
Set the name of the Logger. |
Methods inherited from class org.apache.logging.log4j.message.ParameterizedMessage |
---|
countArgumentPlaceholders, deepToString, equals, format, getFormattedMessage, getMessageFormat, getParameters, getThrowable, hashCode, identityToString, setMessageFormat, setParameters, setParameters, setThrowable, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public LocalizedMessage()
public LocalizedMessage(String messagePattern, String[] stringArgs, Throwable throwable)
public LocalizedMessage(String bundleId, String key, String[] stringArgs, Throwable throwable)
public LocalizedMessage(ResourceBundle bundle, String key, String[] stringArgs, Throwable throwable)
public LocalizedMessage(String bundleId, Locale locale, String key, String[] stringArgs, Throwable throwable)
public LocalizedMessage(ResourceBundle bundle, Locale locale, String key, String[] stringArgs, Throwable throwable)
public LocalizedMessage(Locale locale, String key, String[] stringArgs, Throwable throwable)
public LocalizedMessage(String messagePattern, Object[] arguments)
This method returns a LocalizedMessage which contains the arguments converted to String as well as an optional Throwable.
If the last argument is a Throwable and is NOT used up by a placeholder in the message
pattern it is returned in LocalizedMessage.getThrowable() and won't be contained in the
created String[].
If it is used up ParameterizedMessage.getThrowable() will return null even if the last
argument was a Throwable!
messagePattern
- the message pattern that to be checked for placeholders.arguments
- the argument array to be converted.public LocalizedMessage(String bundleId, String key, Object[] arguments)
public LocalizedMessage(ResourceBundle bundle, String key, Object[] arguments)
public LocalizedMessage(String bundleId, 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 bundleId, String key, Object arg)
public LocalizedMessage(ResourceBundle bundle, String key, Object arg)
public LocalizedMessage(String bundleId, 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 bundleId, String key, Object arg1, Object arg2)
public LocalizedMessage(ResourceBundle bundle, String key, Object arg1, Object arg2)
public LocalizedMessage(String bundleId, 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)
Method Detail |
---|
public void setLoggerName(String name)
setLoggerName
in interface LoggerNameAwareMessage
name
- The name of the Logger.public String getLoggerName()
getLoggerName
in interface LoggerNameAwareMessage
public String formatMessage(String messagePattern, String[] args)
formatMessage
in class ParameterizedMessage
messagePattern
- The key for the resource bundle or the pattern if the bundle doesn't contain the key.args
- The parameters.
protected ResourceBundle getBundle(String key, Locale locale, boolean loop)
key
- The key to the bundle.locale
- 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.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |