diff options
author | a.sreekumar <ajith.sreekumar@bell.ca> | 2021-01-20 14:35:18 +0000 |
---|---|---|
committer | a.sreekumar <ajith.sreekumar@bell.ca> | 2021-01-20 15:33:19 +0000 |
commit | de9bb70b25d498e844c2c6205061aa9e5e9d8d7a (patch) | |
tree | 63c8e6322a408444f672a4f0e3423ec8334d9e65 /plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main | |
parent | 514e435b6ad37525d781b383081cd10c12c2ce46 (diff) |
Add logs for REST request/response in APEX
Change-Id: Ibf2cf19a1ec91473d8c655b87a712aa8738848c8
Issue-ID: POLICY-3003
Signed-off-by: a.sreekumar <ajith.sreekumar@bell.ca>
Diffstat (limited to 'plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main')
-rw-r--r-- | plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientProducer.java | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientProducer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientProducer.java index d777d2c89..565587f62 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientProducer.java +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientProducer.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2019-2020 Nordix Foundation. + * Modifications Copyright (C) 2021 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,6 +34,9 @@ import org.onap.policy.apex.service.engine.event.ApexEventRuntimeException; import org.onap.policy.apex.service.engine.event.ApexPluginsEventProducer; import org.onap.policy.apex.service.parameters.carriertechnology.RestPluginCarrierTechnologyParameters; import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters; +import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; +import org.onap.policy.common.endpoints.utils.NetLoggerUtil; +import org.onap.policy.common.endpoints.utils.NetLoggerUtil.EventType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -114,22 +118,18 @@ public class ApexRestClientProducer extends ApexPluginsEventProducer { // @formatter:on } + NetLoggerUtil.log(EventType.OUT, CommInfrastructure.REST, untaggedUrl, event.toString()); // Send the event as a REST request final Response response = sendEventAsRestRequest(untaggedUrl, (String) event); + NetLoggerUtil.log(EventType.IN, CommInfrastructure.REST, untaggedUrl, response.readEntity(String.class)); + // Check that the request worked if (response.getStatus() != Response.Status.OK.getStatusCode()) { final String errorMessage = "send of event to URL \"" + untaggedUrl + "\" using HTTP \"" - + restProducerProperties.getHttpMethod() + "\" failed with status code " + response.getStatus() - + " and message \"" + response.readEntity(String.class) + "\", event:\n" + event; - LOGGER.warn(errorMessage); + + restProducerProperties.getHttpMethod() + "\" failed with status code " + response.getStatus(); throw new ApexEventRuntimeException(errorMessage); } - - if (LOGGER.isTraceEnabled()) { - LOGGER.trace("event sent from engine using {} to URL {} with HTTP {} : {} and response {} ", this.name, - untaggedUrl, restProducerProperties.getHttpMethod(), event, response); - } } /** |