You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by se...@apache.org on 2017/02/22 17:20:26 UTC
cxf git commit: Optionally disabling the live logging in the new
feature too
Repository: cxf
Updated Branches:
refs/heads/master 437c7daa3 -> b0a79aa7b
Optionally disabling the live logging in the new feature too
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/b0a79aa7
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/b0a79aa7
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/b0a79aa7
Branch: refs/heads/master
Commit: b0a79aa7b48da6acdc6da1169abd690ecf914ca8
Parents: 437c7da
Author: Sergey Beryozkin <sb...@gmail.com>
Authored: Wed Feb 22 17:19:57 2017 +0000
Committer: Sergey Beryozkin <sb...@gmail.com>
Committed: Wed Feb 22 17:19:57 2017 +0000
----------------------------------------------------------------------
.../apache/cxf/ext/logging/AbstractLoggingInterceptor.java | 9 ++++++++-
.../org/apache/cxf/ext/logging/LoggingInInterceptor.java | 3 +++
.../org/apache/cxf/ext/logging/LoggingOutInterceptor.java | 3 +++
3 files changed, 14 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf/blob/b0a79aa7/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/AbstractLoggingInterceptor.java
----------------------------------------------------------------------
diff --git a/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/AbstractLoggingInterceptor.java b/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/AbstractLoggingInterceptor.java
index a64c39c..ba9b678 100644
--- a/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/AbstractLoggingInterceptor.java
+++ b/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/AbstractLoggingInterceptor.java
@@ -20,9 +20,11 @@ package org.apache.cxf.ext.logging;
import java.util.UUID;
+import org.apache.cxf.common.util.PropertyUtils;
import org.apache.cxf.ext.logging.event.LogEvent;
import org.apache.cxf.ext.logging.event.LogEventSender;
import org.apache.cxf.ext.logging.event.PrettyLoggingFilter;
+import org.apache.cxf.interceptor.Fault;
import org.apache.cxf.message.Exchange;
import org.apache.cxf.message.Message;
import org.apache.cxf.phase.AbstractPhaseInterceptor;
@@ -30,7 +32,7 @@ import org.apache.cxf.phase.AbstractPhaseInterceptor;
public abstract class AbstractLoggingInterceptor extends AbstractPhaseInterceptor<Message> {
public static final int DEFAULT_LIMIT = 48 * 1024;
public static final String CONTENT_SUPPRESSED = "--- Content suppressed ---";
-
+ private static final String LIVE_LOGGING_PROP = "org.apache.cxf.logging.enable";
protected int limit = DEFAULT_LIMIT;
protected long threshold = -1;
protected boolean logBinary;
@@ -43,6 +45,11 @@ public abstract class AbstractLoggingInterceptor extends AbstractPhaseIntercepto
this.sender = sender;
}
+ protected static boolean isLoggingDisabledNow(Message message) throws Fault {
+ Object liveLoggingProp = message.getContextualProperty(LIVE_LOGGING_PROP);
+ return liveLoggingProp != null && PropertyUtils.isFalse(liveLoggingProp);
+ }
+
public void setLimit(int lim) {
this.limit = lim;
}
http://git-wip-us.apache.org/repos/asf/cxf/blob/b0a79aa7/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/LoggingInInterceptor.java
----------------------------------------------------------------------
diff --git a/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/LoggingInInterceptor.java b/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/LoggingInInterceptor.java
index da2afa1..80dafee 100644
--- a/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/LoggingInInterceptor.java
+++ b/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/LoggingInInterceptor.java
@@ -75,6 +75,9 @@ public class LoggingInInterceptor extends AbstractLoggingInterceptor {
}
public void handleMessage(Message message) throws Fault {
+ if (isLoggingDisabledNow(message)) {
+ return;
+ }
createExchangeId(message);
final LogEvent event = new DefaultLogEventMapper().map(message);
if (shouldLogContent(event)) {
http://git-wip-us.apache.org/repos/asf/cxf/blob/b0a79aa7/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/LoggingOutInterceptor.java
----------------------------------------------------------------------
diff --git a/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/LoggingOutInterceptor.java b/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/LoggingOutInterceptor.java
index 7d25139..dffe268 100644
--- a/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/LoggingOutInterceptor.java
+++ b/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/LoggingOutInterceptor.java
@@ -58,6 +58,9 @@ public class LoggingOutInterceptor extends AbstractLoggingInterceptor {
}
public void handleMessage(Message message) throws Fault {
+ if (isLoggingDisabledNow(message)) {
+ return;
+ }
createExchangeId(message);
final OutputStream os = message.getContent(OutputStream.class);
if (os != null) {