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

[1/5] logging-log4j-audit git commit: [LOG4J2-2429] don't cascade on method invocations

Repository: logging-log4j-audit
Updated Branches:
  refs/heads/master 9c8d514b6 -> 8f460ee02


[LOG4J2-2429] don't cascade on method invocations


Project: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/commit/16fa4833
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/tree/16fa4833
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/diff/16fa4833

Branch: refs/heads/master
Commit: 16fa48335b4ff7f06102689f237b5f4e7d398f79
Parents: 07e5419
Author: Andrei Ivanov <an...@arnia.ro>
Authored: Sun Sep 23 15:00:00 2018 +0300
Committer: Andrei Ivanov <an...@arnia.ro>
Committed: Sun Sep 23 15:00:00 2018 +0300

----------------------------------------------------------------------
 .../apache/logging/log4j/audit/LogEventFactory.java  |  6 +++++-
 .../org/apache/logging/log4j/audit/LoginTest.java    | 15 ++++++++++++++-
 2 files changed, 19 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/16fa4833/log4j-audit/log4j-audit-api/src/main/java/org/apache/logging/log4j/audit/LogEventFactory.java
----------------------------------------------------------------------
diff --git a/log4j-audit/log4j-audit-api/src/main/java/org/apache/logging/log4j/audit/LogEventFactory.java b/log4j-audit/log4j-audit-api/src/main/java/org/apache/logging/log4j/audit/LogEventFactory.java
index 2362a50..119e78d 100644
--- a/log4j-audit/log4j-audit-api/src/main/java/org/apache/logging/log4j/audit/LogEventFactory.java
+++ b/log4j-audit/log4j-audit-api/src/main/java/org/apache/logging/log4j/audit/LogEventFactory.java
@@ -301,13 +301,15 @@ public class LogEventFactory {
 				}
 
                 logEvent(msg, auditExceptionHandler);
+				return null;
 			}
             if (method.getName().equals("setCompletionStatus")) {
-                String name = NamingUtils.lowerFirst(NamingUtils.getMethodShortName(method.getName()));
                 if (objects == null || objects[0] == null) {
                     throw new IllegalArgumentException("Missing completion status");
                 }
+                String name = NamingUtils.lowerFirst(NamingUtils.getMethodShortName(method.getName()));
                 msg.put(name, objects[0].toString());
+                return null;
             }
             if (method.getName().equals("setAuditExceptionHandler")) {
 			    if (objects == null || objects[0] == null) {
@@ -317,6 +319,7 @@ public class LogEventFactory {
                 } else {
 			        throw new IllegalArgumentException(objects[0] + " is not an " + AuditExceptionHandler.class.getName());
                 }
+                return null;
             }
 			if (method.getName().startsWith("set")) {
 				String name = NamingUtils.lowerFirst(NamingUtils.getMethodShortName(method.getName()));
@@ -355,6 +358,7 @@ public class LogEventFactory {
                 }
 
 				msg.put(name, result);
+                return null;
 			}
 
 			return null;

http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/16fa4833/log4j-audit/log4j-audit-api/src/test/java/org/apache/logging/log4j/audit/LoginTest.java
----------------------------------------------------------------------
diff --git a/log4j-audit/log4j-audit-api/src/test/java/org/apache/logging/log4j/audit/LoginTest.java b/log4j-audit/log4j-audit-api/src/test/java/org/apache/logging/log4j/audit/LoginTest.java
index 190ccd6..aa28ba3 100644
--- a/log4j-audit/log4j-audit-api/src/test/java/org/apache/logging/log4j/audit/LoginTest.java
+++ b/log4j-audit/log4j-audit-api/src/test/java/org/apache/logging/log4j/audit/LoginTest.java
@@ -20,9 +20,22 @@ public class LoginTest extends BaseEventTest {
 
         event.logEvent();
 
+        AuditExceptionHandler exceptionHandler = (message, ex) -> {
+
+        };
+        event.setAuditExceptionHandler(exceptionHandler);
+        event.logEvent();
+
         List<String> msgs = app.getMessages();
         assertNotNull("No messages", msgs);
-        assertTrue("No messages", msgs.size() == 2);
+        assertTrue("No messages", msgs.size() == 3);
+
+        String msg = msgs.get(1);
+        assertTrue("No completionStatus", msg.contains("completionStatus=\"Success\""));
+
+        msg = msgs.get(2);
+        assertTrue("auditExceptionHandler should not be present in the context", !msg.contains("auditExceptionHandler=\""));
+        msgs.forEach(System.out::println);
     }
 
     @Test


[2/5] logging-log4j-audit git commit: [LOG4J2-2429] use same formatting as surrounding lines

Posted by rg...@apache.org.
[LOG4J2-2429] use same formatting as surrounding lines


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

Branch: refs/heads/master
Commit: 3f3a56f43781d5d5735a2154bfddab4414778a92
Parents: 16fa483
Author: Andrei Ivanov <an...@arnia.ro>
Authored: Sun Sep 23 15:02:52 2018 +0300
Committer: Andrei Ivanov <an...@arnia.ro>
Committed: Sun Sep 23 15:02:52 2018 +0300

----------------------------------------------------------------------
 .../java/org/apache/logging/log4j/audit/LogEventFactory.java     | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/3f3a56f4/log4j-audit/log4j-audit-api/src/main/java/org/apache/logging/log4j/audit/LogEventFactory.java
----------------------------------------------------------------------
diff --git a/log4j-audit/log4j-audit-api/src/main/java/org/apache/logging/log4j/audit/LogEventFactory.java b/log4j-audit/log4j-audit-api/src/main/java/org/apache/logging/log4j/audit/LogEventFactory.java
index 119e78d..f68f067 100644
--- a/log4j-audit/log4j-audit-api/src/main/java/org/apache/logging/log4j/audit/LogEventFactory.java
+++ b/log4j-audit/log4j-audit-api/src/main/java/org/apache/logging/log4j/audit/LogEventFactory.java
@@ -301,7 +301,7 @@ public class LogEventFactory {
 				}
 
                 logEvent(msg, auditExceptionHandler);
-				return null;
+                return null;
 			}
             if (method.getName().equals("setCompletionStatus")) {
                 if (objects == null || objects[0] == null) {
@@ -358,7 +358,7 @@ public class LogEventFactory {
                 }
 
 				msg.put(name, result);
-                return null;
+				return null;
 			}
 
 			return null;


[5/5] logging-log4j-audit git commit: LOG4J2-2429 - Setting the exceptionHandler on the AuditEvent sets it as a ThreadContext variable

Posted by rg...@apache.org.
LOG4J2-2429 - Setting the exceptionHandler on the AuditEvent sets it as a ThreadContext variable


Project: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/commit/8f460ee0
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/tree/8f460ee0
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/diff/8f460ee0

Branch: refs/heads/master
Commit: 8f460ee0208316becb12e343441700aec41339f1
Parents: 73cfc05
Author: Ralph Goers <rg...@apache.org>
Authored: Sun Sep 23 07:45:16 2018 -1000
Committer: Ralph Goers <rg...@apache.org>
Committed: Sun Sep 23 07:45:16 2018 -1000

----------------------------------------------------------------------
 src/changes/changes.xml | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/8f460ee0/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index ede29af..513bc9f 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -31,6 +31,9 @@
          - "remove" - Removed
     -->
     <release version="1.0.1" date="YYYY-MM-DD" description="Release 1.0.1">
+      <action issue="LOG4J2-2429" dev="rgoers" type="fix" due-to="Andrei Ivanov">
+        Setting the exceptionHandler on the AuditEvent sets it as a ThreadContext variable.
+      </action>
       <action issue="LOG4J2-2421" dev="rgoers" type="fix" due-to="Andrei Ivanov">
         Add verbose parameter to the Log4j audit Maven plugin.
       </action>


[4/5] logging-log4j-audit git commit: Closes #10

Posted by rg...@apache.org.
Closes #10


Project: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/commit/73cfc051
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/tree/73cfc051
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/diff/73cfc051

Branch: refs/heads/master
Commit: 73cfc051a9d66f70d0857b215b4ed111fa3cf6f5
Parents: 9c8d514 da38500
Author: Ralph Goers <rg...@apache.org>
Authored: Sun Sep 23 07:42:58 2018 -1000
Committer: Ralph Goers <rg...@apache.org>
Committed: Sun Sep 23 07:42:58 2018 -1000

----------------------------------------------------------------------
 .../logging/log4j/audit/LogEventFactory.java      |  6 +++++-
 .../org/apache/logging/log4j/audit/LoginTest.java | 18 +++++++++++++++---
 2 files changed, 20 insertions(+), 4 deletions(-)
----------------------------------------------------------------------



[3/5] logging-log4j-audit git commit: [LOG4J2-2429] cleanup assertions

Posted by rg...@apache.org.
[LOG4J2-2429] cleanup assertions


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

Branch: refs/heads/master
Commit: da385005f631386b72255910db9579b84064b96c
Parents: 3f3a56f
Author: Andrei Ivanov <an...@arnia.ro>
Authored: Sun Sep 23 15:04:36 2018 +0300
Committer: Andrei Ivanov <an...@arnia.ro>
Committed: Sun Sep 23 15:04:36 2018 +0300

----------------------------------------------------------------------
 .../test/java/org/apache/logging/log4j/audit/LoginTest.java   | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/da385005/log4j-audit/log4j-audit-api/src/test/java/org/apache/logging/log4j/audit/LoginTest.java
----------------------------------------------------------------------
diff --git a/log4j-audit/log4j-audit-api/src/test/java/org/apache/logging/log4j/audit/LoginTest.java b/log4j-audit/log4j-audit-api/src/test/java/org/apache/logging/log4j/audit/LoginTest.java
index aa28ba3..d49c742 100644
--- a/log4j-audit/log4j-audit-api/src/test/java/org/apache/logging/log4j/audit/LoginTest.java
+++ b/log4j-audit/log4j-audit-api/src/test/java/org/apache/logging/log4j/audit/LoginTest.java
@@ -6,8 +6,7 @@ import org.junit.Test;
 import java.util.Collections;
 import java.util.List;
 
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.*;
 
 public class LoginTest extends BaseEventTest {
     @Test
@@ -28,13 +27,13 @@ public class LoginTest extends BaseEventTest {
 
         List<String> msgs = app.getMessages();
         assertNotNull("No messages", msgs);
-        assertTrue("No messages", msgs.size() == 3);
+        assertEquals("No messages", 3, msgs.size());
 
         String msg = msgs.get(1);
         assertTrue("No completionStatus", msg.contains("completionStatus=\"Success\""));
 
         msg = msgs.get(2);
-        assertTrue("auditExceptionHandler should not be present in the context", !msg.contains("auditExceptionHandler=\""));
+        assertFalse("auditExceptionHandler should not be present in the context", msg.contains("auditExceptionHandler=\""));
         msgs.forEach(System.out::println);
     }