You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by ma...@apache.org on 2016/11/16 18:54:00 UTC
logging-log4j2 git commit: Simplify Groovy filter scripts in tests
Repository: logging-log4j2
Updated Branches:
refs/heads/master 8eb2e7277 -> 1b9c7f6cd
Simplify Groovy filter scripts in tests
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/1b9c7f6c
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/1b9c7f6c
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/1b9c7f6c
Branch: refs/heads/master
Commit: 1b9c7f6cdd4572de2b580d320131ec1435da5bb3
Parents: 8eb2e72
Author: Matt Sicker <bo...@gmail.com>
Authored: Wed Nov 16 12:53:47 2016 -0600
Committer: Matt Sicker <bo...@gmail.com>
Committed: Wed Nov 16 12:53:47 2016 -0600
----------------------------------------------------------------------
log4j-core/src/test/resources/log4j-script-filters.xml | 7 +------
log4j-core/src/test/resources/scripts/filter.groovy | 7 +------
2 files changed, 2 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/1b9c7f6c/log4j-core/src/test/resources/log4j-script-filters.xml
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/resources/log4j-script-filters.xml b/log4j-core/src/test/resources/log4j-script-filters.xml
index 4168554..85d81d1 100644
--- a/log4j-core/src/test/resources/log4j-script-filters.xml
+++ b/log4j-core/src/test/resources/log4j-script-filters.xml
@@ -42,12 +42,7 @@
<AppenderRef ref="List">
<ScriptFilter onMatch="ACCEPT" onMisMatch="DENY">
<Script name="GroovyFilter" language="groovy"><![CDATA[
- if (logEvent.getMarker() != null && logEvent.getMarker().isInstanceOf("FLOW")) {
- return true;
- } else if (logEvent.getContextMap().containsKey("UserId")) {
- return true;
- }
- return false;
+ logEvent.marker?.isInstanceOf('FLOW') || logEvent.contextMap.containsKey('UserId')
]]>
</Script>
</ScriptFilter>
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/1b9c7f6c/log4j-core/src/test/resources/scripts/filter.groovy
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/resources/scripts/filter.groovy b/log4j-core/src/test/resources/scripts/filter.groovy
index 94d3b55..2beac2f 100644
--- a/log4j-core/src/test/resources/scripts/filter.groovy
+++ b/log4j-core/src/test/resources/scripts/filter.groovy
@@ -1,6 +1 @@
-if (logEvent.getMarker() != null && logEvent.getMarker().isInstanceOf("FLOW")) {
- return true;
-} else if (logEvent.getContextMap().containsKey("UserId")) {
- return true;
-}
-return false;
+return logEvent.marker?.isInstanceOf('FLOW') || logEvent.contextMap.containsKey('UserId')