Skip to content

Commit 286d597

Browse files
authored
Merge pull request wso2#2233 from RakhithaRR/AI-5273
[4.2.0] Add a synapse property to handle exclusing payload details in error logs
2 parents d4f3b61 + 5ce843b commit 286d597

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

modules/core/src/main/java/org/apache/synapse/SynapseConstants.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,7 @@ public enum ENDPOINT_TIMEOUT_TYPE { ENDPOINT_TIMEOUT, GLOBAL_TIMEOUT, HTTP_CONNE
609609
public static final String MAX_FAILOVER_RECUSIVE_RETRIES_CONFIG = "maximum.failover.recursive.retries";
610610
public static final String SUSPEND_DURATION_ON_MAX_RECURSIVE_FAILOVER_CONFIG =
611611
"suspend.duration.on.maximum.recursive.failover";
612+
public static final String EXCLUDE_PAYLOAD_DETAILS_FROM_ERROR = "exclude.payload.details.from.error";
612613

613614
/**
614615
* Synapse Configuration holder property name, used for handling synapse import deployments

modules/core/src/main/java/org/apache/synapse/core/axis2/Axis2Sender.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import org.apache.synapse.SynapseHandler;
3939
import org.apache.synapse.commons.throttle.core.ConcurrentAccessController;
4040
import org.apache.synapse.commons.throttle.core.ConcurrentAccessReplicator;
41+
import org.apache.synapse.config.SynapsePropertiesLoader;
4142
import org.apache.synapse.endpoints.EndpointDefinition;
4243
import org.apache.synapse.inbound.InboundEndpointConstants;
4344
import org.apache.synapse.inbound.InboundResponseSender;
@@ -61,6 +62,8 @@ public class Axis2Sender {
6162
* Content type header name.
6263
*/
6364
private static final String CONTENT_TYPE_STRING = "Content-Type";
65+
private static final boolean removeHeaders = SynapsePropertiesLoader
66+
.getBooleanProperty(SynapseConstants.EXCLUDE_PAYLOAD_DETAILS_FROM_ERROR, false);
6467

6568
/**
6669
* Send a message out from the Synapse engine to an external service
@@ -299,7 +302,7 @@ private static String getResponseMessage(MessageContext msgContext) {
299302
}
300303
Map<String, Object> mHeader = (Map<String, Object>) msgContext.getProperty
301304
(org.apache.axis2.context.MessageContext.TRANSPORT_HEADERS);
302-
if (mHeader != null) {
305+
if (!removeHeaders && mHeader != null) {
303306
for (String strKey : mHeader.keySet()) {
304307
sb.append(strKey + ":" + mHeader.get(strKey).toString() + ",");
305308
}

0 commit comments

Comments
 (0)