You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by mi...@apache.org on 2017/01/08 20:04:54 UTC

[1/2] logging-log4j2 git commit: LOG4J-1724 Fix due-to name

Repository: logging-log4j2
Updated Branches:
  refs/heads/master 2a20c1592 -> aa87e8530


LOG4J-1724 Fix due-to name


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

Branch: refs/heads/master
Commit: 3d69614e7d34947bc5613b4823add8ad96677f9d
Parents: 2a20c15
Author: Mikael St�ldal <mi...@magine.com>
Authored: Sun Jan 8 20:57:10 2017 +0100
Committer: Mikael St�ldal <mi...@magine.com>
Committed: Sun Jan 8 20:57:10 2017 +0100

----------------------------------------------------------------------
 src/changes/changes.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/3d69614e/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index b4f4e28..5af7579 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -27,7 +27,7 @@
       <action issue="LOG4J2-1769" dev="rpopma" type="fix" due-to="Brandon Goodin">
         Fixed concurrency issue affecting all layouts except PatternLayout and GelfLayout, which caused scrambled output and exceptions when logging synchronously from multiple threads.
       </action>
-      <action issue="LOG4J2-1724" dev="mikes" type="fix" due-to="Alexander K">
+      <action issue="LOG4J2-1724" dev="mikes" type="fix" due-to="Alexander Krasnostavsky">
         Using variables in GelfLayout's additional fields at runtime.
       </action>
       <action issue="LOG4J2-1762" dev="mikes" type="fix">


[2/2] logging-log4j2 git commit: LOG4J-1724 Fix configuration validation

Posted by mi...@apache.org.
LOG4J-1724 Fix configuration validation


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

Branch: refs/heads/master
Commit: aa87e8530c319e5e64f22e2c2a24a3748e9aab5b
Parents: 3d69614
Author: Mikael St�ldal <mi...@magine.com>
Authored: Sun Jan 8 21:04:47 2017 +0100
Committer: Mikael St�ldal <mi...@magine.com>
Committed: Sun Jan 8 21:04:47 2017 +0100

----------------------------------------------------------------------
 .../java/org/apache/logging/log4j/core/layout/GelfLayout.java | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/aa87e853/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/GelfLayout.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/GelfLayout.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/GelfLayout.java
index dfac30f..b5a7ff4 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/GelfLayout.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/GelfLayout.java
@@ -237,7 +237,7 @@ public final class GelfLayout extends AbstractStringLayout {
     @Deprecated
     public GelfLayout(final String host, final KeyValuePair[] additionalFields, final CompressionType compressionType,
                       final int compressionThreshold, final boolean includeStacktrace) {
-        this(((LoggerContext) LogManager.getContext(false)).getConfiguration(), host, additionalFields, compressionType, compressionThreshold, includeStacktrace, true);
+        this(null, host, additionalFields, compressionType, compressionThreshold, includeStacktrace, true);
     }
 
     private GelfLayout(final Configuration config, final String host, final KeyValuePair[] additionalFields, final CompressionType compressionType,
@@ -245,6 +245,9 @@ public final class GelfLayout extends AbstractStringLayout {
         super(config, StandardCharsets.UTF_8, null, null);
         this.host = host != null ? host : NetUtils.getLocalHostname();
         this.additionalFields = additionalFields != null ? additionalFields : new KeyValuePair[0];
+        if (this.additionalFields.length > 0 && config == null) {
+            throw new IllegalArgumentException("configuration needs to be set when there are additional fields");
+        }
         this.compressionType = compressionType;
         this.compressionThreshold = compressionThreshold;
         this.includeStacktrace = includeStacktrace;
@@ -266,7 +269,7 @@ public final class GelfLayout extends AbstractStringLayout {
             @PluginAttribute(value = "includeStacktrace",
                 defaultBoolean = true) final boolean includeStacktrace) {
             // @formatter:on
-        return new GelfLayout(((LoggerContext) LogManager.getContext(false)).getConfiguration(), host, additionalFields, compressionType, compressionThreshold, includeStacktrace, true);
+        return new GelfLayout(null, host, additionalFields, compressionType, compressionThreshold, includeStacktrace, true);
     }
 
     @PluginBuilderFactory