blob: daf6e634e1cdd9642ecdd6dd352dfa65cc907537 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_144) on Wed Dec 11 21:05:25 MST 2019 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Message (Apache Log4j API 2.13.0 API)</title>
<meta name="date" content="2019-12-11">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Message (Apache Log4j API 2.13.0 API)";
}
}
catch(err) {
}
//-->
var methods = {"i0":6,"i1":6,"i2":6,"i3":6};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],4:["t3","Abstract Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/Message.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../org/apache/logging/log4j/message/MapMessage.MapFormat.html" title="enum in org.apache.logging.log4j.message"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../../../org/apache/logging/log4j/message/MessageCollectionMessage.html" title="interface in org.apache.logging.log4j.message"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/logging/log4j/message/Message.html" target="_top">Frames</a></li>
<li><a href="Message.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">org.apache.logging.log4j.message</div>
<h2 title="Interface Message" class="title">Interface Message</h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Superinterfaces:</dt>
<dd><a href="https://docs.oracle.com/javase/8/docs/api/java/io/Serializable.html?is-external=true" title="class or interface in java.io">Serializable</a></dd>
</dl>
<dl>
<dt>All Known Subinterfaces:</dt>
<dd><a href="../../../../../org/apache/logging/log4j/message/EntryMessage.html" title="interface in org.apache.logging.log4j.message">EntryMessage</a>, <a href="../../../../../org/apache/logging/log4j/message/ExitMessage.html" title="interface in org.apache.logging.log4j.message">ExitMessage</a>, <a href="../../../../../org/apache/logging/log4j/message/FlowMessage.html" title="interface in org.apache.logging.log4j.message">FlowMessage</a>, <a href="../../../../../org/apache/logging/log4j/message/MessageCollectionMessage.html" title="interface in org.apache.logging.log4j.message">MessageCollectionMessage</a>&lt;T&gt;, <a href="../../../../../org/apache/logging/log4j/message/MultiformatMessage.html" title="interface in org.apache.logging.log4j.message">MultiformatMessage</a>, <a href="../../../../../org/apache/logging/log4j/util/MultiFormatStringBuilderFormattable.html" title="interface in org.apache.logging.log4j.util">MultiFormatStringBuilderFormattable</a>, <a href="../../../../../org/apache/logging/log4j/message/ReusableMessage.html" title="interface in org.apache.logging.log4j.message">ReusableMessage</a></dd>
</dl>
<dl>
<dt>All Known Implementing Classes:</dt>
<dd><a href="../../../../../org/apache/logging/log4j/message/FormattedMessage.html" title="class in org.apache.logging.log4j.message">FormattedMessage</a>, <a href="../../../../../org/apache/logging/log4j/message/LocalizedMessage.html" title="class in org.apache.logging.log4j.message">LocalizedMessage</a>, <a href="../../../../../org/apache/logging/log4j/message/MapMessage.html" title="class in org.apache.logging.log4j.message">MapMessage</a>, <a href="../../../../../org/apache/logging/log4j/message/MessageFormatMessage.html" title="class in org.apache.logging.log4j.message">MessageFormatMessage</a>, <a href="../../../../../org/apache/logging/log4j/message/ObjectArrayMessage.html" title="class in org.apache.logging.log4j.message">ObjectArrayMessage</a>, <a href="../../../../../org/apache/logging/log4j/message/ObjectMessage.html" title="class in org.apache.logging.log4j.message">ObjectMessage</a>, <a href="../../../../../org/apache/logging/log4j/message/ParameterizedMessage.html" title="class in org.apache.logging.log4j.message">ParameterizedMessage</a>, <a href="../../../../../org/apache/logging/log4j/message/ReusableObjectMessage.html" title="class in org.apache.logging.log4j.message">ReusableObjectMessage</a>, <a href="../../../../../org/apache/logging/log4j/message/ReusableParameterizedMessage.html" title="class in org.apache.logging.log4j.message">ReusableParameterizedMessage</a>, <a href="../../../../../org/apache/logging/log4j/message/ReusableSimpleMessage.html" title="class in org.apache.logging.log4j.message">ReusableSimpleMessage</a>, <a href="../../../../../org/apache/logging/log4j/message/SimpleMessage.html" title="class in org.apache.logging.log4j.message">SimpleMessage</a>, <a href="../../../../../org/apache/logging/log4j/message/StringFormattedMessage.html" title="class in org.apache.logging.log4j.message">StringFormattedMessage</a>, <a href="../../../../../org/apache/logging/log4j/message/StringMapMessage.html" title="class in org.apache.logging.log4j.message">StringMapMessage</a>, <a href="../../../../../org/apache/logging/log4j/message/StructuredDataCollectionMessage.html" title="class in org.apache.logging.log4j.message">StructuredDataCollectionMessage</a>, <a href="../../../../../org/apache/logging/log4j/message/StructuredDataMessage.html" title="class in org.apache.logging.log4j.message">StructuredDataMessage</a>, <a href="../../../../../org/apache/logging/log4j/message/ThreadDumpMessage.html" title="class in org.apache.logging.log4j.message">ThreadDumpMessage</a></dd>
</dl>
<hr>
<br>
<pre>public interface <a href="../../../../../src-html/org/apache/logging/log4j/message/Message.html#line.46">Message</a>
extends <a href="https://docs.oracle.com/javase/8/docs/api/java/io/Serializable.html?is-external=true" title="class or interface in java.io">Serializable</a></pre>
<div class="block">An interface for various Message implementations that can be logged. Messages can act as wrappers
around Objects so that user can have control over converting Objects to Strings when necessary without
requiring complicated formatters and as a way to manipulate the message based on information available
at runtime such as the locale of the system.
<p>
Custom Message implementations should consider implementing the <a href="../../../../../org/apache/logging/log4j/util/StringBuilderFormattable.html" title="interface in org.apache.logging.log4j.util"><code>StringBuilderFormattable</code></a>
interface for more efficient processing. Garbage-free Layouts will call
<a href="../../../../../org/apache/logging/log4j/util/StringBuilderFormattable.html#formatTo-java.lang.StringBuilder-"><code>formatTo(StringBuilder)</code></a> instead of
<a href="../../../../../org/apache/logging/log4j/message/Message.html#getFormattedMessage--"><code>getFormattedMessage()</code></a> if the Message implements StringBuilderFormattable.
</p>
<p>
Note: Message objects should not be considered to be thread safe nor should they be assumed to be
safely reusable even on the same thread. The logging system may provide information to the Message
objects and the Messages might be queued for asynchronous delivery. Thus, any modifications to a
Message object by an application should by avoided after the Message has been passed as a parameter on
a Logger method.
</p></div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../org/apache/logging/log4j/util/StringBuilderFormattable.html" title="interface in org.apache.logging.log4j.util"><code>StringBuilderFormattable</code></a></dd>
</dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t3" class="tableTab"><span><a href="javascript:show(4);">Abstract Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/logging/log4j/message/Message.html#getFormat--">getFormat</a></span>()</code>
<div class="block">Gets the format portion of the Message.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/logging/log4j/message/Message.html#getFormattedMessage--">getFormattedMessage</a></span>()</code>
<div class="block">Gets the Message formatted as a String.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>[]</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/logging/log4j/message/Message.html#getParameters--">getParameters</a></span>()</code>
<div class="block">Gets parameter values, if any.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang">Throwable</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/logging/log4j/message/Message.html#getThrowable--">getThrowable</a></span>()</code>
<div class="block">Gets the throwable, if any.</div>
</td>
</tr>
</table>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="getFormattedMessage--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getFormattedMessage</h4>
<pre><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;<a href="../../../../../src-html/org/apache/logging/log4j/message/Message.html#line.69">getFormattedMessage</a>()</pre>
<div class="block">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.
<p>
When configured to log asynchronously, this method is called before the Message is queued, unless this
message implements <a href="../../../../../org/apache/logging/log4j/message/ReusableMessage.html" title="interface in org.apache.logging.log4j.message"><code>ReusableMessage</code></a> or is annotated with <a href="../../../../../org/apache/logging/log4j/message/AsynchronouslyFormattable.html" title="annotation in org.apache.logging.log4j.message"><code>AsynchronouslyFormattable</code></a>.
This gives the Message implementation class a chance to create a formatted message String with the current value
of any mutable objects.
The intention is that the Message implementation caches this formatted message and returns it on subsequent
calls. (See <a href="https://issues.apache.org/jira/browse/LOG4J2-763">LOG4J2-763</a>.)
</p>
<p>
When logging synchronously, this method will not be called for Messages that implement the
<a href="../../../../../org/apache/logging/log4j/util/StringBuilderFormattable.html" title="interface in org.apache.logging.log4j.util"><code>StringBuilderFormattable</code></a> interface: instead, the
<a href="../../../../../org/apache/logging/log4j/util/StringBuilderFormattable.html#formatTo-java.lang.StringBuilder-"><code>formatTo(StringBuilder)</code></a> method will be called so the
Message can format its contents without creating intermediate String objects.
</p></div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The message String.</dd>
</dl>
</li>
</ul>
<a name="getFormat--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getFormat</h4>
<pre><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;<a href="../../../../../src-html/org/apache/logging/log4j/message/Message.html#line.82">getFormat</a>()</pre>
<div class="block">Gets the format portion of the Message.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The message format. Some implementations, such as ParameterizedMessage, will use this as
the message "pattern". Other Messages may simply return an empty String.
TODO Do all messages have a format? What syntax? Using a Formatter object could be cleaner.
(RG) In SimpleMessage the format is identical to the formatted message. In ParameterizedMessage and
StructuredDataMessage it is not. It is up to the Message implementer to determine what this
method will return. A Formatter is inappropriate as this is very specific to the Message
implementation so it isn't clear to me how having a Formatter separate from the Message would be cleaner.</dd>
</dl>
</li>
</ul>
<a name="getParameters--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getParameters</h4>
<pre><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>[]&nbsp;<a href="../../../../../src-html/org/apache/logging/log4j/message/Message.html#line.89">getParameters</a>()</pre>
<div class="block">Gets parameter values, if any.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>An array of parameter values or null.</dd>
</dl>
</li>
</ul>
<a name="getThrowable--">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>getThrowable</h4>
<pre><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang">Throwable</a>&nbsp;<a href="../../../../../src-html/org/apache/logging/log4j/message/Message.html#line.96">getThrowable</a>()</pre>
<div class="block">Gets the throwable, if any.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the throwable or null.</dd>
</dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/Message.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../org/apache/logging/log4j/message/MapMessage.MapFormat.html" title="enum in org.apache.logging.log4j.message"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../../../org/apache/logging/log4j/message/MessageCollectionMessage.html" title="interface in org.apache.logging.log4j.message"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/logging/log4j/message/Message.html" target="_top">Frames</a></li>
<li><a href="Message.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small><p align="center">Copyright &#169; 1999-2019 <a href="https://www.apache.org/">The Apache Software Foundation</a>. All Rights Reserved.<br /> 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.</p></small></p>
</body>
</html>