FormattedMessage instances for MessageFactory2 methods (and MessageFactory by
extension.)
Creates SimpleMessage objects that do not retain a reference to the parameter object.
Intended for use by the StatusLogger: this logger retains a queue of recently logged messages in memory,
causing memory leaks in web applications. (LOG4J2-1176)
This class is immutable.
Note to implementors:
This class does not implement any MessageFactory2 methods and lets the superclass funnel those calls
through newMessage(String, Object..
| Modifier and Type | Class and Description |
|---|---|
| pack-priv static class | ParameterizedNoReferenceMessageFactory.
Message implementation that only keeps a reference to the error text and the error (if any), not to the message parameters, in order to avoid memory leaks. |
| Modifier and Type | Field and Description |
|---|---|
| public static final ParameterizedNoReferenceMessageFactory | INSTANCE
Instance of ParameterizedStatusMessageFactory. |
| private static final long |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public Message | Returns: The Message.The message pattern. message, final Object... The message parameters. params)Implements org. Creates |
| INSTANCE | back to summary |
|---|---|
| public static final ParameterizedNoReferenceMessageFactory INSTANCE Instance of ParameterizedStatusMessageFactory. | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Hides org. | |
| ParameterizedNoReferenceMessageFactory | back to summary |
|---|---|
| public ParameterizedNoReferenceMessageFactory() Constructs a message factory with default flow strings. | |
| newMessage | back to summary |
|---|---|
| public Message newMessage(final String message, final Object... params) Implements org. Creates
| |
| Modifier and Type | Field and Description |
|---|---|
| private final String | |
| private static final long | |
| private final Throwable |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public String | getFormat()
Implements org. Gets the format portion of the Message. |
| public String | getFormattedMessage()
Implements org. Gets the Message formatted as a String. |
| public Object[] | getParameters()
Implements org. Gets parameter values, if any. |
| public Throwable | getThrowable()
Implements org. Gets the throwable, if any. |
| formattedMessage | back to summary |
|---|---|
| private final String formattedMessage | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID | |
| throwable | back to summary |
|---|---|
| private final Throwable throwable | |
| StatusMessage | back to summary |
|---|---|
| public StatusMessage(final String formattedMessage, final Throwable throwable) | |
| getFormat | back to summary |
|---|---|
| public String getFormat() Implements org. Doc from org. Gets the format portion of the Message.
| |
| getFormattedMessage | back to summary |
|---|---|
| public String getFormattedMessage() Implements org. Doc from org. Gets the Message formatted as a String. Each Message implementation determines the appropriate way to format the data encapsulated in the Message. Messages that provide more than one way of formatting the Message will implement MultiformatMessage.
When configured to log asynchronously, this method is called before the Message is queued, unless this
message implements
When logging synchronously, this method will not be called for Messages that implement the
| |
| getParameters | back to summary |
|---|---|
| public Object[] getParameters() Implements org. Doc from org. Gets parameter values, if any. | |
| getThrowable | back to summary |
|---|---|
| public Throwable getThrowable() Implements org. Doc from org. Gets the throwable, if any. | |