From 2d1632f1c930b02f567b4650cc7f27a40f1dfe1b Mon Sep 17 00:00:00 2001 From: "Balaji, Ramya (rb111y)" Date: Wed, 7 Nov 2018 21:52:36 -0500 Subject: More logging added to debug Issue-ID: APPC-1231 Change-Id: I45790aff545c566fbf62ea1908143b15f3920122 Signed-off-by: Balaji, Ramya (rb111y) --- .../messaging/dmaap/http/HttpDmaapProducerImpl.java | 8 ++++++++ .../adapter/messaging/dmaap/impl/DmaapProducerImpl.java | 3 ++- .../appc/messageadapter/impl/MessageAdapterImpl.java | 1 + .../org/onap/appc/requesthandler/conv/Converter.java | 16 +++++++++++++--- 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/onap/appc/adapter/messaging/dmaap/http/HttpDmaapProducerImpl.java b/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/onap/appc/adapter/messaging/dmaap/http/HttpDmaapProducerImpl.java index ca3420a2c..3a986c31e 100644 --- a/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/onap/appc/adapter/messaging/dmaap/http/HttpDmaapProducerImpl.java +++ b/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/onap/appc/adapter/messaging/dmaap/http/HttpDmaapProducerImpl.java @@ -68,12 +68,14 @@ public class HttpDmaapProducerImpl extends CommonHttpClient implements Producer @Override public boolean post(String partition, String data) { + LOG.debug("Entering HttpDmaapProducerImpl::: post "); long sent = 0; try { HttpPost request = postReq(null); request.setHeader("Content-Type", CONTENT_TYPE); request.setEntity(new StringEntity(bodyLine(partition, data))); + LOG.debug("Before sendRequest HttpDmaapProducerImpl::: post "); sent = topics.stream() .filter(topic -> sendRequest(request, topic)) .count(); @@ -84,6 +86,7 @@ public class HttpDmaapProducerImpl extends CommonHttpClient implements Producer data, buildEx.getMessage()), buildEx); } + LOG.debug("Exiting HttpDmaapProducerImpl::: post "); return sent == topics.size(); } @@ -92,10 +95,15 @@ public class HttpDmaapProducerImpl extends CommonHttpClient implements Producer String uriStr = String.format(URL_TEMPLATE, hosts.get(0), topic); try { request.setURI(new URI(uriStr)); + LOG.debug("HttpDmaapProducerImpl::: before sendRequest()"); CloseableHttpResponse response = getClient().execute(request); + LOG.debug("HttpDmaapProducerImpl::: after sendRequest()"); if (response.getStatusLine().getStatusCode() == 200) { successful = true; } + else { + LOG.debug("HttpDmaapProducerImpl::: did not receive 200 for sendRequest"); + } response.close(); } catch (Exception sendEx) { LOG.error(String.format("Failed to send message to %s. Reason: %s", uriStr, sendEx.getMessage()), diff --git a/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/onap/appc/adapter/messaging/dmaap/impl/DmaapProducerImpl.java b/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/onap/appc/adapter/messaging/dmaap/impl/DmaapProducerImpl.java index b9a760596..e86ca97c1 100644 --- a/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/onap/appc/adapter/messaging/dmaap/impl/DmaapProducerImpl.java +++ b/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/onap/appc/adapter/messaging/dmaap/impl/DmaapProducerImpl.java @@ -139,6 +139,7 @@ public class DmaapProducerImpl implements Producer { @Override public boolean post(String partition, String data) { + LOG.debug("In DmaapProducerImpl.post()"); boolean success = true; Properties properties = configuration.getProperties(); if (properties != null && properties.getProperty("metric.enabled") != null) { @@ -154,7 +155,7 @@ public class DmaapProducerImpl implements Producer { LOG.info("Getting CambriaBatchingPublisher Clients ..."); clients = getClients(); } - + LOG.debug("In DmaapProducerImpl.post()::: before sending to clients"); for (MRBatchingPublisher client : clients) { try { LOG.debug(String.format("Posting %s to %s", data, client)); diff --git a/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/main/java/org/onap/appc/messageadapter/impl/MessageAdapterImpl.java b/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/main/java/org/onap/appc/messageadapter/impl/MessageAdapterImpl.java index d7422415e..c0a52b141 100644 --- a/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/main/java/org/onap/appc/messageadapter/impl/MessageAdapterImpl.java +++ b/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/main/java/org/onap/appc/messageadapter/impl/MessageAdapterImpl.java @@ -63,6 +63,7 @@ public class MessageAdapterImpl implements MessageAdapter{ */ @Override public void init(){ + logger.debug("MessageAdapterImpl - init"); this.producer = getProducer(); } diff --git a/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/main/java/org/onap/appc/requesthandler/conv/Converter.java b/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/main/java/org/onap/appc/requesthandler/conv/Converter.java index b01d36bc4..84605ff53 100644 --- a/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/main/java/org/onap/appc/requesthandler/conv/Converter.java +++ b/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/main/java/org/onap/appc/requesthandler/conv/Converter.java @@ -25,6 +25,7 @@ package org.onap.appc.requesthandler.conv; +import com.att.aft.dme2.internal.apache.commons.lang3.StringUtils; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; @@ -289,10 +290,12 @@ public class Converter { } public static Payload convAsyncResponseTorev160108Payload(ResponseContext inObj) { + logger.debug("Entering convAsyncResponseTorev160108Payload" ); Payload payload = null; if(inObj.getPayload() != null) { payload = new Payload(inObj.getPayload()); } + logger.debug("Exiting convAsyncResponseTorev160108Payload" ); return payload; } @@ -316,13 +319,16 @@ public class Converter { } public static Status convAsyncResponseTorev160108Status(ResponseContext inObj) { + logger.debug("Entering convAsyncResponseTorev160108Status"); StatusBuilder statusBuilder = new StatusBuilder(); statusBuilder.setCode(inObj.getStatus().getCode()); statusBuilder.setMessage(inObj.getStatus().getMessage()); + logger.debug("Exiting convAsyncResponseTorev160108Status"); return statusBuilder.build(); } public static CommonHeader convAsyncResponseTorev160108CommonHeader(ResponseContext inObj) { + logger.debug("Entered into convAsyncResponseTorev160108CommonHeader"); CommonHeader outObj = null; if(inObj == null){ throw new IllegalArgumentException("empty asyncResponse"); @@ -335,23 +341,26 @@ public class Converter { commonHeaderBuilder.setFlags(commonHeaderFlags); } - + logger.debug("Before setApiVer"); commonHeaderBuilder.setApiVer(inObj.getCommonHeader().getApiVer()); commonHeaderBuilder.setRequestId(inObj.getCommonHeader().getRequestId()); if(inObj.getCommonHeader().getSubRequestId() != null){ commonHeaderBuilder.setSubRequestId(inObj.getCommonHeader().getSubRequestId()); } - + logger.debug("Before getOriginatorId"); if(inObj.getCommonHeader().getOriginatorId() != null){ commonHeaderBuilder.setOriginatorId(inObj.getCommonHeader().getOriginatorId()); } - + logger.debug("Before getTimeStamp"); if(inObj.getCommonHeader().getTimeStamp() != null){ String zuluTimestampStr = Converter.convDateToZuluString(inObj.getCommonHeader().getTimeStamp()); + logger.debug("After invoking convDateToZuluString()"); ZULU zuluTimestamp = new ZULU(zuluTimestampStr); + logger.debug("After ZULU()"); commonHeaderBuilder.setTimestamp(zuluTimestamp); } outObj = commonHeaderBuilder.build(); + logger.debug("Exiting from convAsyncResponseTorev160108CommonHeader: Returning outObj::"+outObj.toString()); return outObj; } @@ -435,6 +444,7 @@ public class Converter { outObj.setCorrelationID(correlationID); outObj.setType("response"); outObj.setRpcName(rpcName); + logger.debug("In onverter.convAsyncResponseToDmaapOutgoingMessage() before invoking convAsyncResponseToBuilder"); Builder builder = Converter.convAsyncResponseToBuilder(vnfOperation, rpcName, asyncResponse); Object messageBody = builder.build(); DmaapOutgoingMessage.Body body = new DmaapOutgoingMessage.Body(messageBody); -- cgit 1.2.3-korg