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/19 16:55:56 UTC

[1/2] logging-log4j2 git commit: LOG4J2-1297 various content and structure improvements

Repository: logging-log4j2
Updated Branches:
  refs/heads/master 84d7077b9 -> d993bbc57


LOG4J2-1297 various content and structure 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/eaf1e3a1
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/eaf1e3a1
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/eaf1e3a1

Branch: refs/heads/master
Commit: eaf1e3a14aad2086a39cdbdec6da84f29ce896c5
Parents: 7921535
Author: rpopma <rp...@apache.org>
Authored: Tue Apr 19 23:55:48 2016 +0900
Committer: rpopma <rp...@apache.org>
Committed: Tue Apr 19 23:55:48 2016 +0900

----------------------------------------------------------------------
 src/site/xdoc/manual/garbagefree.xml | 35 +++++++++++++------------------
 1 file changed, 15 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/eaf1e3a1/src/site/xdoc/manual/garbagefree.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/manual/garbagefree.xml b/src/site/xdoc/manual/garbagefree.xml
index e0e39aa..66cd532 100644
--- a/src/site/xdoc/manual/garbagefree.xml
+++ b/src/site/xdoc/manual/garbagefree.xml
@@ -38,7 +38,7 @@
         This contributes to pressure on the garbage collector and increases the frequency with which GC pauses occur.
       </p>
       <p>
-        From version 2.6, Log4j by default runs in "garbage free" mode ("low garbage" for web applications)
+        From version 2.6, Log4j runs in "garbage free" mode by default ("low garbage" mode for web applications)
         where objects and buffers are reused and temporary object allocation is avoided as much as possible.
       </p>
       <p>
@@ -78,11 +78,8 @@
         </table>
       </subsection>
 
-      <a name="Enable" />
-      <subsection name="Enabling Garbage-free Logging">
-        <a name="Config" />
-        <subsubsection name="Configuration">
-          <h4>Configuration</h4>
+      <a name="Config" />
+      <subsection name="Configuration">
           <p>
             In Log4j 2.6, garbage-free logging is enabled by default, except in web applications.
             Log4j will partially disable garbage-free logging if it detects that it is used in a web application
@@ -102,14 +99,18 @@
             So while logging is not completely garbage-free for web applications yet,
             the pressure on the garbage collector can still be significantly reduced.
           </p>
+          <table><tr><td><b>Caution:</b> as of version 2.6, a Log4j configuration containing a <tt>&lt;Properties&gt;</tt> section
+            will result in temporary objects being created during steady-state logging.
+          </td></tr></table>
+          <h4>Disabling Garbage-free Logging</h4>
           <p>
-            There are two separate system properties for manually disabling the mechanisms Log4j uses to avoid
+            There are two separate system properties for manually controlling the mechanisms Log4j uses to avoid
             creating temporary objects:
           </p>
           <ul>
             <li><tt>log4j2.enable.threadlocals</tt> - if "true" (the default for non-web applications)
               objects are stored in ThreadLocal fields and reused, otherwise new
-              objects are created for each log event</li>
+              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:
               <em>synchronous</em> logging performance may be worse for multi-threaded applications in this mode due to
@@ -121,10 +122,6 @@
             Instead of system properties, the above properties can also be specified in a file named
             <tt>log4j2.component.properties</tt> by including this file in the classpath of the application.
           </p>
-          <table><tr><td><b>Caution:</b> as of version 2.6, a Log4j configuration containing a <tt>&lt;Properties&gt;</tt> section
-            will result in temporary objects being created during steady-state logging.
-          </td></tr></table>
-        </subsubsection>
         <a name="Appenders" />
         <subsubsection name="Supported Appenders">
           <h4>Supported Appenders</h4>
@@ -148,10 +145,6 @@
         <subsubsection name="Supported Layouts">
           <h4>Supported Layouts</h4>
 
-          <p>
-            <em>Note:</em>Logging Exceptions and stack traces will create temporary objects with any layout.
-          </p>
-
           <h5>GelfLayout</h5>
           <p>GelfLayout is garbage-free when used with compressionType="OFF".</p>
 
@@ -268,7 +261,9 @@
             to avoid creating temporary objects in future releases. (Patches welcome!)
           </p>
           <p>
-            We haven't figured out a way to log Exceptions and stack traces without creating temporary objects.
+            <em>Note</em>: Logging exceptions and stack traces will create temporary objects with any layout.
+            (However, Layouts will only create these temporary objects when an exception actually occurs.)
+            We haven't figured out a way to log exceptions and stack traces without creating temporary objects.
             That is unfortunate, but you probably still want to log them when they happen.
           </p>
           <table><tr><td><b>Caution:</b> patterns containing regular expressions and lookups for property substitution
@@ -373,9 +368,9 @@ public void garbageFree() {
         </p>
         <p>
           Custom Layouts that want to be garbage-free should implement the <tt>Encoder&lt;LogEvent&gt;</tt> interface.
-          The <tt>org.apache.logging.log4j.core.layout.TextEncoder</tt> class may be useful for custom
-          Layouts that convert a LogEvent to a text
-          representation.
+          For custom Layouts that convert a LogEvent to a text representation,
+          the <tt>org.apache.logging.log4j.core.layout.StringBuilderEncoder</tt> class may be useful to convert this
+          text to bytes in a garbage-free manner.
         </p>
         <p>
           Custom Appenders that want to be garbage-free should provide their Layout with a


[2/2] logging-log4j2 git commit: Merge remote-tracking branch 'origin/master'

Posted by rp...@apache.org.
Merge remote-tracking branch 'origin/master'


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

Branch: refs/heads/master
Commit: d993bbc573097842b57ab74b1899c9f6825e70fa
Parents: eaf1e3a 84d7077
Author: rpopma <rp...@apache.org>
Authored: Tue Apr 19 23:56:05 2016 +0900
Committer: rpopma <rp...@apache.org>
Committed: Tue Apr 19 23:56:05 2016 +0900

----------------------------------------------------------------------
 .../rolling/DefaultRolloverStrategy.java        |  4 +-
 .../rolling/RollingAppenderSizeTest.java        |  6 +-
 .../src/test/resources/log4j-rolling-xy.xml     | 59 --------------------
 .../src/test/resources/log4j-rolling-xz.xml     | 59 ++++++++++++++++++++
 src/changes/changes.xml                         |  3 +
 5 files changed, 67 insertions(+), 64 deletions(-)
----------------------------------------------------------------------