You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by rp...@apache.org on 2016/06/04 12:25:45 UTC
logging-log4j2 git commit: improved garbage-free documentation: add
reference to StringBuilderFormattable
Repository: logging-log4j2
Updated Branches:
refs/heads/master f31b07b07 -> 00b7de455
improved garbage-free documentation: add reference to StringBuilderFormattable
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/00b7de45
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/00b7de45
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/00b7de45
Branch: refs/heads/master
Commit: 00b7de455590ae1826407c7b8711de3c310ff93c
Parents: f31b07b
Author: rpopma <rp...@apache.org>
Authored: Sat Jun 4 21:26:38 2016 +0900
Committer: rpopma <rp...@apache.org>
Committed: Sat Jun 4 21:26:38 2016 +0900
----------------------------------------------------------------------
src/site/xdoc/manual/garbagefree.xml | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/00b7de45/src/site/xdoc/manual/garbagefree.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/manual/garbagefree.xml b/src/site/xdoc/manual/garbagefree.xml
index 2320840..58ca1d0 100644
--- a/src/site/xdoc/manual/garbagefree.xml
+++ b/src/site/xdoc/manual/garbagefree.xml
@@ -303,7 +303,7 @@
when logging messages with up to ten parameters.
</p>
<p>
- Also, methods have been added to the <tt>Logger</tt> interface to log <tt>CharSequence</tt> messages.
+ Also, methods have been added to the <tt>Logger</tt> interface to log <tt>java.lang.CharSequence</tt> messages.
User-defined objects that implement the <tt>CharSequence</tt> interface can be logged without creating
temporary objects: Log4j will try to turn CharSequence messages,
Object messages and message parameters
@@ -311,6 +311,13 @@
This avoids calling <tt>toString()</tt> on these objects.
</p>
<p>
+ An alternative is to implement the
+ <a href="http://logging.apache.org/log4j/2.x/log4j-api/xref/org/apache/logging/log4j/util/StringBuilderFormattable.html"><tt>org.apache.logging.log4j.util.StringBuilderFormattable</tt></a>
+ interface.
+ If an object is logged that implements this interface, its <tt>formatTo</tt> method is called instead of
+ <tt>toString()</tt>.
+ </p>
+ <p>
Log4j may call <tt>toString()</tt> on message and parameter objects when garbage-free logging
is disabled (when system property <tt>log4j2.enable.threadlocals</tt> is set to "false".)
</p>