From dfbfeb9cb15f84dbb4fcb825a7ae701cbbb1ab34 Mon Sep 17 00:00:00 2001 From: t-muskans <t-muskans@microsoft.com> Date: Tue, 1 Jun 2021 15:39:27 +0530 Subject: [PATCH] changed logger --- .../osdu/indexer/azure/service/RetryPolicy.java | 14 ++++++++------ .../azure/service/UrlFetchServiceAzureImpl.java | 8 +++++--- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/provider/indexer-azure/src/main/java/org/opengroup/osdu/indexer/azure/service/RetryPolicy.java b/provider/indexer-azure/src/main/java/org/opengroup/osdu/indexer/azure/service/RetryPolicy.java index d6515fce8..9fcf09a89 100644 --- a/provider/indexer-azure/src/main/java/org/opengroup/osdu/indexer/azure/service/RetryPolicy.java +++ b/provider/indexer-azure/src/main/java/org/opengroup/osdu/indexer/azure/service/RetryPolicy.java @@ -20,12 +20,11 @@ import com.google.gson.JsonObject; import com.google.gson.JsonParser; import io.github.resilience4j.retry.RetryConfig; import lombok.Data; -import lombok.extern.java.Log; +import org.opengroup.osdu.core.common.logging.JaxRsDpsLog; import org.opengroup.osdu.core.common.model.http.HttpResponse; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; import org.springframework.stereotype.Component; -import org.springframework.stereotype.Service; import java.time.Duration; @@ -33,12 +32,15 @@ import java.time.Duration; * This class handles retry configuration logic for calls made to <prefix>/storage/v2/query/records:batch * to resolve intermittent CosmosDb Not found issue */ -@Log + @Component @Data -@ConfigurationProperties(prefix = "azure.urlfetchservice.retry") +@ConfigurationProperties(prefix = "azure.storage.client.retry") public class RetryPolicy { + @Autowired + private JaxRsDpsLog logger; + private int attempts = 3; private int waitDuration = 1000; private final String RECORD_NOT_FOUND = "notFound"; @@ -71,7 +73,7 @@ public class RetryPolicy { notFoundElement.getAsJsonArray().isJsonNull()) { return false; } - log.info("Retry is set true"); + logger.info("Retry is set true"); return true; } } diff --git a/provider/indexer-azure/src/main/java/org/opengroup/osdu/indexer/azure/service/UrlFetchServiceAzureImpl.java b/provider/indexer-azure/src/main/java/org/opengroup/osdu/indexer/azure/service/UrlFetchServiceAzureImpl.java index 1e0453120..d56b888fa 100644 --- a/provider/indexer-azure/src/main/java/org/opengroup/osdu/indexer/azure/service/UrlFetchServiceAzureImpl.java +++ b/provider/indexer-azure/src/main/java/org/opengroup/osdu/indexer/azure/service/UrlFetchServiceAzureImpl.java @@ -17,10 +17,10 @@ package org.opengroup.osdu.indexer.azure.service; import io.github.resilience4j.retry.Retry; import io.github.resilience4j.retry.RetryConfig; import io.github.resilience4j.retry.RetryRegistry; -import lombok.extern.java.Log; import org.opengroup.osdu.core.common.http.FetchServiceHttpRequest; import org.opengroup.osdu.core.common.http.IUrlFetchService; import org.opengroup.osdu.core.common.http.UrlFetchServiceImpl; +import org.opengroup.osdu.core.common.logging.JaxRsDpsLog; import org.opengroup.osdu.core.common.model.http.HttpResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Primary; @@ -34,7 +34,7 @@ import java.util.function.Supplier; * This class has same function as that of UrlFetchService except in the case of * <prefix>/storage/v2/query/records:batch call for which it enables retry */ -@Log + @Service @RequestScope @Primary @@ -48,6 +48,8 @@ public class UrlFetchServiceAzureImpl implements IUrlFetchService { @Autowired private UrlFetchServiceImpl urlFetchService; + @Autowired + private JaxRsDpsLog logger; /** * this method invokes retryFunction only for <prefix>/storage/v2/query/records:batch * calls otherwise invokes UrlFetchService.sendRequest(FetchServiceHttpRequest request) @@ -84,7 +86,7 @@ public class UrlFetchServiceAzureImpl implements IUrlFetchService { try { return this.urlFetchService.sendRequest(request); } catch (URISyntaxException e) { - log.info("HttpResponse is null due to URISyntaxException. " + e.getReason()); + logger.error("HttpResponse is null due to URISyntaxException. " + e.getReason()); return null; } }; -- GitLab