Skip to content

Commit

Permalink
Merge pull request #32 from sasin07/release-v2.0.0-orange
Browse files Browse the repository at this point in the history
ANLT-566 | Change the errorResponse variable name in log manager 2.0.0
  • Loading branch information
pdkgamage authored Mar 2, 2020
2 parents afbb153 + a41ecb4 commit 82d0fa2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<groupId>com.wso2telco</groupId>
<artifactId>logging-extension</artifactId>
<name>logging-extension</name>
<version>2.0.0-orange</version>
<version>2.0.1-orange</version>
<packaging>bundle</packaging>
<dependencies>
<dependency>
Expand Down
21 changes: 10 additions & 11 deletions src/main/java/com/wso2telco/logging/PropertyLogHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import org.apache.commons.logging.LogFactory;
import org.apache.synapse.ManagedLifecycle;
import org.apache.synapse.MessageContext;
import org.apache.axis2.context.*;
import org.apache.synapse.config.Entry;
import org.apache.synapse.core.SynapseEnvironment;
import org.apache.synapse.core.axis2.Axis2MessageContext;
Expand All @@ -42,9 +41,9 @@ public class PropertyLogHandler extends AbstractMediator implements ManagedLifec
private static final String REGISTRY_PATH = "gov:/apimgt/";
private static final String MESSAGE_TYPE = "message.type";
private static final String PAYLOAD_LOGGING_ENABLED = "payload.logging.enabled";
private static final String REQUEST = "REQUEST";
private static final String RESPONSE = "RESPONSE";
private static final String ERRORRESPONSE = "ERRORRESPONSE";
private static final String REQUEST = "request";
private static final String RESPONSE = "response";
private static final String ERRORRESPONSE = "errorResponse";
private static final String UUID = "MESSAGE_ID";
private static final String ERROR = "error";
private static final String REST_SUB_REQUEST_PATH = "REST_SUB_REQUEST_PATH";
Expand All @@ -69,11 +68,11 @@ public void init(SynapseEnvironment synapseEnvironment) {
DocumentBuilder documentBuilder = dbf.newDocumentBuilder();
Document document = documentBuilder.parse(fXmlFile);
document.getDocumentElement().normalize();
NodeList requestAttributes = document.getElementsByTagName(REQUEST);
NodeList requestAttributes = document.getElementsByTagName(REQUEST.toUpperCase());
PropertyReader.setLogProperties(requestAttributes, REQUEST);
NodeList responseAttributes = document.getElementsByTagName(RESPONSE);
NodeList responseAttributes = document.getElementsByTagName(RESPONSE.toUpperCase());
PropertyReader.setLogProperties(responseAttributes, RESPONSE);
NodeList errorAttributes = document.getElementsByTagName(ERRORRESPONSE);
NodeList errorAttributes = document.getElementsByTagName(ERRORRESPONSE.toUpperCase());
PropertyReader.setLogProperties(errorAttributes, ERRORRESPONSE);

}
Expand Down Expand Up @@ -105,7 +104,7 @@ public boolean mediate(MessageContext messageContext) {
} else if (direction.equalsIgnoreCase(RESPONSE)) {
logProperties(messageContext, axis2MessageContext, isPayloadLoggingEnabled, RESPONSE);
} else if (direction.equalsIgnoreCase(ERROR)) {
logProperties(messageContext, axis2MessageContext, isPayloadLoggingEnabled, ERROR);
logProperties(messageContext, axis2MessageContext, isPayloadLoggingEnabled, ERRORRESPONSE);
}
return true;
} else {
Expand All @@ -125,11 +124,11 @@ private void logProperties(MessageContext messageContext, org.apache.axis2.conte
if (isPayloadLoggingEnabled) {
String transactionPayload = handleAndReturnPayload(messageContext);
Map<String, Object> headerMap = (Map<String, Object>)axis2MessageContext.getProperty(org.apache.axis2.context.MessageContext.TRANSPORT_HEADERS);
StringBuilder transactionLog = new StringBuilder("TRANSACTION:" + typeFlag.toLowerCase());
StringBuilder transactionLog = new StringBuilder("TRANSACTION:" + typeFlag);
HashMap<String, String> transactionMap;
if (typeFlag.equalsIgnoreCase(REQUEST)) {
if (typeFlag.equals(REQUEST)) {
transactionMap = PropertyReader.getRequestpropertyMap();
} else if (typeFlag.equalsIgnoreCase(RESPONSE)) {
} else if (typeFlag.equals(RESPONSE)) {
transactionMap = PropertyReader.getResponsepropertyMap();
} else {
transactionMap = PropertyReader.getErrorPropertiesMap();
Expand Down

0 comments on commit 82d0fa2

Please sign in to comment.