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/04/18 18:04:57 UTC

logging-log4j2 git commit: LOG4J2-1297 minor content improvements

Repository: logging-log4j2
Updated Branches:
  refs/heads/master fb5347dbd -> eea60ec56


LOG4J2-1297 minor content improvements


Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/eea60ec5
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/eea60ec5
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/eea60ec5

Branch: refs/heads/master
Commit: eea60ec564c0043a63698b439ad39ae9659d27e6
Parents: fb5347d
Author: rpopma <rp...@apache.org>
Authored: Tue Apr 19 01:05:02 2016 +0900
Committer: rpopma <rp...@apache.org>
Committed: Tue Apr 19 01:05:02 2016 +0900

----------------------------------------------------------------------
 src/site/xdoc/manual/garbagefree.xml | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/eea60ec5/src/site/xdoc/manual/garbagefree.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/manual/garbagefree.xml b/src/site/xdoc/manual/garbagefree.xml
index c1f3a7d..55e8c42 100644
--- a/src/site/xdoc/manual/garbagefree.xml
+++ b/src/site/xdoc/manual/garbagefree.xml
@@ -33,7 +33,7 @@
         significant effort is spent on controlling these pauses.
       </p>
       <p>
-        Many logging libraries, including previous versions of Log4j, allocate many temporary objects like
+        Many logging libraries, including previous versions of Log4j, allocate temporary objects like
         log event objects, Strings, char arrays, byte arrays and more during steady state logging.
         This contributes to pressure on the garbage collector and increases the frequency with which GC pauses occur.
       </p>
@@ -47,8 +47,9 @@
       <a name="jfr" />
       <subsection name="A Contrived Example">
         <p>
-          To highlight the difference, we used Java Flight Recorder to measure a simple application that
-          does nothing but log a simple string as often as possible for about 12 seconds.
+          To highlight the difference that garbage-free logging can make, we used Java Flight Recorder
+          to measure a simple application that does nothing but log a simple string as often as possible
+          for about 12 seconds.
         </p>
         <p>
           The application was configured to use Async Loggers, a RandomAccessFile appender and a
@@ -110,9 +111,10 @@
               objects are stored in ThreadLocal fields and reused, otherwise new
               objects are created for each log event</li>
             <li><tt>log4j2.enable.direct.encoders</tt> - if "true" (the default) log events are converted to text and this
-              text is converted to bytes without creating temporary objects. Caution: multi-threaded applications
-              that use synchronous logging may see worse performance: the lock that was previously only around the
-              IO operation is widened to include the text formatting and conversion to bytes.
+              text is converted to bytes without creating temporary objects. Caution:
+              <em>synchronous</em> logging performance may be worse for multi-threaded applications in this mode due to
+              synchronization on the shared buffer. If your application is multi-threaded and logging performance
+              is important, consider using Async Loggers.
               </li>
           </ul>
           <p>
@@ -170,7 +172,7 @@
             </tr>
             <tr>
               <td>%d, %date</td>
-              <td>Caution: Only dates in the predefined formats are garbage-free: (millisecond separator may be either
+              <td>Caution: Only the predefined date formats are garbage-free: (millisecond separator may be either
                 a comma ',' or a period '.')
                 <table>
                   <tr>
@@ -302,16 +304,15 @@
             This avoids calling <tt>toString()</tt> on these objects.
           </p>
           <p>
-            (Note that Log4j may call <tt>toString()</tt> on message and parameter objects when
-            garbage-free logging is disabled
-            because system property <tt>log4j2.enable.threadlocals</tt> is set to "false".)
+            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>
         </subsubsection>
         <a name="codeImpact" />
         <subsubsection name="Impact on Application Code: Autoboxing">
         <h4>Impact on Application Code: Autoboxing</h4>
         <p>
-          We made an effort to make logging code garbage-free without requiring code changes in existing applications,
+          We made an effort to make logging garbage-free without requiring code changes in existing applications,
           but there is one area where this was not possible.
           When logging primitive values (i.e. int, double, boolean, etc.) the JVM
           autoboxes these primitive values to their Object wrapper equivalents, creating garbage.