diff options
author | Fiete Ostkamp <Fiete.Ostkamp@telekom.de> | 2022-10-25 14:18:21 +0000 |
---|---|---|
committer | Fiete Ostkamp <Fiete.Ostkamp@telekom.de> | 2022-10-26 13:13:10 +0000 |
commit | 89d9d635ea2e701ae0dce72584b24f1541998787 (patch) | |
tree | 6431229276cc393e6764a874a619faece2c4b663 /src | |
parent | eee4b72f1c89194889803ae3696a2b12f27b90bb (diff) |
Use the 1.9.4 parent pom in rest-client
- work around metrics logging, a proper solution would probably involve updating eelf-core in the logging service
Issue-ID: AAI-3564
Signed-off-by: Fiete Ostkamp <Fiete.Ostkamp@telekom.de>
Change-Id: I8a21089d9b41e9a973c62c9eac22503ad32fa731
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/onap/aai/restclient/client/RestClient.java | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/main/java/org/onap/aai/restclient/client/RestClient.java b/src/main/java/org/onap/aai/restclient/client/RestClient.java index 89d5c62..9639c9d 100644 --- a/src/main/java/org/onap/aai/restclient/client/RestClient.java +++ b/src/main/java/org/onap/aai/restclient/client/RestClient.java @@ -31,6 +31,7 @@ import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import java.util.stream.Collectors; + import javax.ws.rs.client.Client; import javax.ws.rs.client.Entity; import javax.ws.rs.client.Invocation.Builder; @@ -39,16 +40,17 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedHashMap; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.Response; -import org.onap.aai.cl.api.LogFields; + import org.onap.aai.cl.api.LogLine; -import org.onap.aai.cl.api.Logger; -import org.onap.aai.cl.eelf.LoggerFactory; import org.onap.aai.cl.mdc.MdcContext; import org.onap.aai.cl.mdc.MdcOverride; import org.onap.aai.restclient.enums.RestAuthenticationMode; import org.onap.aai.restclient.logging.RestClientMsgs; import org.onap.aai.restclient.rest.RestClientBuilder; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; + /** @@ -69,11 +71,10 @@ public class RestClient { private static final String REST_CLIENT_INSTANCE = "REST_CLIENT_INSTANCE"; /** Standard logger for producing log statements. */ - private Logger logger = LoggerFactory.getInstance().getLogger("AAIRESTClient"); + private static EELFLogger logger = EELFManager.getLogger(RestClient.class.getName()); /** Standard logger for producing metric statements. */ - private Logger metricsLogger = LoggerFactory.getInstance().getMetricsLogger("AAIRESTClient"); - + private static EELFLogger metricsLogger = EELFManager.getMetricsLogger(); private SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX"); /** Reusable function call for GET REST operations. */ @@ -389,12 +390,11 @@ public class RestClient { if (responseStatus != null) { responseStatusCodeString = responseStatus.toString(); } - - metricsLogger.info(RestClientMsgs.HTTP_REQUEST_TIME, - new LogFields().setField(LogLine.DefinedFields.STATUS_CODE, responseStatusCodeString) - .setField(LogLine.DefinedFields.RESPONSE_CODE, operationResult.getResultCode()) - .setField(LogLine.DefinedFields.RESPONSE_DESCRIPTION, operationResult.getResult()), - override, requestType, Long.toString(System.currentTimeMillis() - startTimeInMs), url); + Map<String, String> logFields = new HashMap<String, String>(); + logFields.put(LogLine.DefinedFields.STATUS_CODE.name(), responseStatusCodeString); + logFields.put(LogLine.DefinedFields.RESPONSE_CODE.name(), String.valueOf(operationResult.getResultCode())); + logFields.put(LogLine.DefinedFields.RESPONSE_DESCRIPTION.name(), operationResult.getResult()); + metricsLogger.info(RestClientMsgs.HTTP_REQUEST_TIME, logFields.toString(), requestType, Long.toString(System.currentTimeMillis() - startTimeInMs), url); logger.info(RestClientMsgs.HTTP_REQUEST_TIME, requestType, Long.toString(System.currentTimeMillis() - startTimeInMs), url); logger.info(RestClientMsgs.HTTP_RESPONSE, url, |