Skip to content

Commit

Permalink
Merge pull request #2127 from RakhithaRR/AI-5133
Browse files Browse the repository at this point in the history
Add a synapse property to handle excluding payload details in error logs
  • Loading branch information
RakhithaRR authored Jan 16, 2024
2 parents 088d191 + da23a81 commit a3623cb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,7 @@ public enum ENDPOINT_TIMEOUT_TYPE { ENDPOINT_TIMEOUT, GLOBAL_TIMEOUT, HTTP_CONNE
public static final String MAX_FAILOVER_RECUSIVE_RETRIES_CONFIG = "maximum.failover.recursive.retries";
public static final String SUSPEND_DURATION_ON_MAX_RECURSIVE_FAILOVER_CONFIG =
"suspend.duration.on.maximum.recursive.failover";
public static final String EXCLUDE_PAYLOAD_DETAILS_FROM_ERROR = "exclude.payload.details.from.error";

/**
* Synapse Configuration holder property name, used for handling synapse import deployments
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import org.apache.synapse.SynapseHandler;
import org.apache.synapse.commons.throttle.core.ConcurrentAccessController;
import org.apache.synapse.commons.throttle.core.ConcurrentAccessReplicator;
import org.apache.synapse.config.SynapsePropertiesLoader;
import org.apache.synapse.endpoints.EndpointDefinition;
import org.apache.synapse.inbound.InboundEndpointConstants;
import org.apache.synapse.inbound.InboundResponseSender;
Expand All @@ -61,6 +62,8 @@ public class Axis2Sender {
* Content type header name.
*/
private static final String CONTENT_TYPE_STRING = "Content-Type";
private static final boolean removeHeaders = SynapsePropertiesLoader
.getBooleanProperty(SynapseConstants.EXCLUDE_PAYLOAD_DETAILS_FROM_ERROR, false);

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

0 comments on commit a3623cb

Please sign in to comment.