You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by gg...@apache.org on 2018/09/15 16:38:25 UTC

logging-log4j2 git commit: [LOG4J2-2446] Add a Base64 string lookup (adapted from Apache Commons Text 1.5.)

Repository: logging-log4j2
Updated Branches:
  refs/heads/master fa27894c1 -> e15e88492


[LOG4J2-2446] Add a Base64 string lookup (adapted from Apache Commons
Text 1.5.)

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

Branch: refs/heads/master
Commit: e15e884927a847b27695f56f73176e474cebfa1a
Parents: fa27894
Author: Gary Gregory <gg...@rocketsoftware.com>
Authored: Sat Sep 15 10:38:21 2018 -0600
Committer: Gary Gregory <gg...@rocketsoftware.com>
Committed: Sat Sep 15 10:38:21 2018 -0600

----------------------------------------------------------------------
 .../log4j/core/lookup/Base64StrLookup.java       | 19 +++++++++++++++++++
 src/changes/changes.xml                          |  3 +++
 2 files changed, 22 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/e15e8849/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/Base64StrLookup.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/Base64StrLookup.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/Base64StrLookup.java
new file mode 100644
index 0000000..d498d98
--- /dev/null
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/Base64StrLookup.java
@@ -0,0 +1,19 @@
+package org.apache.logging.log4j.core.lookup;
+
+import java.util.Base64;
+
+import org.apache.logging.log4j.core.LogEvent;
+
+/**
+ * Decodes Base64 strings.
+ * 
+ * @since 3.0.0
+ */
+public class Base64StrLookup extends AbstractLookup {
+
+    @Override
+    public String lookup(LogEvent event, String key) {
+        return new String(Base64.getDecoder().decode(key));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/e15e8849/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 3521236..b453510 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -283,6 +283,9 @@
       <action issue="LOG4J2-2444" dev="ckozak" type="fix">
         ErrorHandler is invoked with a LogEvent and Throwable when possible, where previously only a string was used.
       </action>
+      <action issue="LOG4J2-2446" dev="ggregory" type="add">
+        Add a Base64 string lookup.
+      </action>
     </release>
     <release version="2.11.1" date="2018-07-22" description="GA Release 2.11.1">
       <action issue="LOG4J2-2389" dev="rgoers" type="fix" due-to="Liu Wen">