Package org.apache.logging.log4j.message
Class FormattedMessage
java.lang.Object
org.apache.logging.log4j.message.FormattedMessage
- All Implemented Interfaces:
Serializable,Message
Handles messages that contain a format String. Dynamically determines if the format conforms to
MessageFormat or String.format and if not then uses ParameterizedMessage to format.
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionFormattedMessage(String messagePattern, Object arg) Constructs with a pattern and a single parameter.FormattedMessage(String messagePattern, Object... arguments) Constructs with a pattern and a parameter array.FormattedMessage(String messagePattern, Object[] arguments, Throwable throwable) Constructs with a pattern, a parameter array, and a throwable.FormattedMessage(String messagePattern, Object arg1, Object arg2) Constructs with a pattern and two parameters.FormattedMessage(Locale locale, String messagePattern, Object arg) Constructs with a locale, a pattern and a single parameter.FormattedMessage(Locale locale, String messagePattern, Object... arguments) Constructs with a locale, a pattern and a parameter array.FormattedMessage(Locale locale, String messagePattern, Object[] arguments, Throwable throwable) Constructs with a locale, a pattern, a parameter array, and a throwable.FormattedMessage(Locale locale, String messagePattern, Object arg1, Object arg2) Constructs with a locale, a pattern and two parameters. -
Method Summary
Modifier and TypeMethodDescriptionbooleanGets the message pattern.Gets the formatted message.protected MessagegetMessage(String msgPattern, Object[] args, Throwable aThrowable) Object[]Gets the message parameters.Gets the throwable, if any.inthashCode()private voidtoString()private void
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
HASHVAL
private static final int HASHVAL- See Also:
-
FORMAT_SPECIFIER
- See Also:
-
MSG_PATTERN
-
messagePattern
-
argArray
-
stringArgs
-
formattedMessage
-
throwable
-
message
-
locale
-
-
Constructor Details
-
FormattedMessage
Constructs with a locale, a pattern and a single parameter.- Parameters:
locale- The localemessagePattern- The message pattern.arg- The parameter.- Since:
- 2.6
-
FormattedMessage
Constructs with a locale, a pattern and two parameters.- Parameters:
locale- The localemessagePattern- The message pattern.arg1- The first parameter.arg2- The second parameter.- Since:
- 2.6
-
FormattedMessage
Constructs with a locale, a pattern and a parameter array.- Parameters:
locale- The localemessagePattern- The message pattern.arguments- The parameter.- Since:
- 2.6
-
FormattedMessage
public FormattedMessage(Locale locale, String messagePattern, Object[] arguments, Throwable throwable) Constructs with a locale, a pattern, a parameter array, and a throwable.- Parameters:
locale- The LocalemessagePattern- The message pattern.arguments- The parameter.throwable- The throwable- Since:
- 2.6
-
FormattedMessage
Constructs with a pattern and a single parameter.- Parameters:
messagePattern- The message pattern.arg- The parameter.
-
FormattedMessage
Constructs with a pattern and two parameters.- Parameters:
messagePattern- The message pattern.arg1- The first parameter.arg2- The second parameter.
-
FormattedMessage
Constructs with a pattern and a parameter array.- Parameters:
messagePattern- The message pattern.arguments- The parameter.
-
FormattedMessage
Constructs with a pattern, a parameter array, and a throwable.- Parameters:
messagePattern- The message pattern.arguments- The parameter.throwable- The throwable
-
-
Method Details
-
equals
-
getFormat
Gets the message pattern. -
getFormattedMessage
Gets the formatted message.- Specified by:
getFormattedMessagein interfaceMessage- Returns:
- the formatted message.
-
getMessage
-
getParameters
Gets the message parameters.- Specified by:
getParametersin interfaceMessage- Returns:
- the message parameters.
-
getThrowable
Description copied from interface:MessageGets the throwable, if any.- Specified by:
getThrowablein interfaceMessage- Returns:
- the throwable or null.
-
hashCode
public int hashCode() -
readObject
- Throws:
IOExceptionClassNotFoundException
-
toString
-
writeObject
- Throws:
IOException
-