This is an automated email from the ASF dual-hosted git repository.

mattsicker pushed a commit to branch release-2.x
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git


The following commit(s) were added to refs/heads/release-2.x by this push:
     new dc5b6b9  [LOG4J2-2693] Use @PluginValue value
dc5b6b9 is described below

commit dc5b6b912623a68828c31fc58d0dd9a79282e484
Author: Matt Sicker <[email protected]>
AuthorDate: Sun Oct 6 15:22:02 2019 -0500

    [LOG4J2-2693] Use @PluginValue value
    
    This fixes the @PluginValue annotation handling to use the specified
    string as the attribute name to look up rather than defaulting to the
    "value" attribute.
    
    This fixes LOG4J2-2647 as well.
---
 .../log4j/core/config/plugins/visitors/PluginValueVisitor.java      | 4 ++--
 src/changes/changes.xml                                             | 6 ++++++
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/visitors/PluginValueVisitor.java
 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/visitors/PluginValueVisitor.java
index 8544570..d2a49d5 100644
--- 
a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/visitors/PluginValueVisitor.java
+++ 
b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/visitors/PluginValueVisitor.java
@@ -37,7 +37,7 @@ public class PluginValueVisitor extends 
AbstractPluginVisitor<PluginValue> {
             final StringBuilder log) {
         final String name = this.annotation.value();
         final String elementValue = node.getValue();
-        final String attributeValue = node.getAttributes().get("value");
+        final String attributeValue = node.getAttributes().get(name);
         String rawValue = null; // if neither is specified, return null 
(LOG4J2-1313)
         if (Strings.isNotEmpty(elementValue)) {
             if (Strings.isNotEmpty(attributeValue)) {
@@ -47,7 +47,7 @@ public class PluginValueVisitor extends 
AbstractPluginVisitor<PluginValue> {
             }
             rawValue = elementValue;
         } else {
-            rawValue = removeAttributeValue(node.getAttributes(), "value");
+            rawValue = removeAttributeValue(node.getAttributes(), name);
         }
         final String value = this.substitutor.replace(event, rawValue);
         StringBuilders.appendKeyDqValue(log, name, value);
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 4238cd7..04bb98e 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -30,6 +30,12 @@
          - "remove" - Removed
     -->
     <release version="2.13.0" date="2019-MM-DD" description="GA Release 
2.13.0">
+      <action issue="LOG4J2-2693" dev="mattsicker" type="fix">
+        @PluginValue does not support attribute names besides "value".
+      </action>
+      <action issue="LOG4J2-2647" dev="mattsicker" type="fix">
+        Validation blocks definition of script in properties configuration.
+      </action>
       <action issue="LOG4J2-2680" dev="rgoers" type="fix" due-to="Guillermo 
Xavier Hurtado Garcia">
         Set result of rename action to true if file was copied.
       </action>

Reply via email to