From fc7f267a77340926473ff1dbc53ab5ea68f08205 Mon Sep 17 00:00:00 2001 From: Bela Juhasz Date: Tue, 21 Sep 2021 13:43:32 +0100 Subject: [PATCH] More verbose error logging for sysinf --- .../cache2k/My2KCachePageFactory.java | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/ega-data-api-res/src/main/java/eu/elixir/ega/ebi/reencryptionmvc/cache2k/My2KCachePageFactory.java b/ega-data-api-res/src/main/java/eu/elixir/ega/ebi/reencryptionmvc/cache2k/My2KCachePageFactory.java index f0c30448..99ee97ee 100644 --- a/ega-data-api-res/src/main/java/eu/elixir/ega/ebi/reencryptionmvc/cache2k/My2KCachePageFactory.java +++ b/ega-data-api-res/src/main/java/eu/elixir/ega/ebi/reencryptionmvc/cache2k/My2KCachePageFactory.java @@ -26,10 +26,10 @@ import eu.elixir.ega.ebi.reencryptionmvc.util.S3Commons; import htsjdk.samtools.seekablestream.cipher.ebi.Glue; import lombok.extern.slf4j.Slf4j; -import org.apache.http.HttpResponse; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.util.EntityUtils; import org.cache2k.Cache; import org.springframework.cloud.client.loadbalancer.LoadBalancerClient; @@ -40,6 +40,7 @@ import java.io.DataInputStream; import java.io.IOException; import java.io.InputStreamReader; +import java.util.Arrays; import java.util.Optional; /** @@ -97,9 +98,21 @@ public byte[] downloadPage(String id, int cachePage) throws IOException { try (CloseableHttpResponse response = httpClient.execute(request)) { if (response.getStatusLine().getStatusCode() != 200 && response.getStatusLine().getStatusCode() != 206) { - log.error("FIRE error loading Cache Page Code " - + response.getStatusLine().getStatusCode() - + " for id '" + id + "' page '" + cachePage + "'"); + final String message = String.format("FIRE error loading Cache Page Code %d for id '%s' page '%d'%n" + + "Request: '%s'%n" + + "Request headers: '%s'%n" + + "Response: '%s'%n" + + "Response statusLine: '%s'%n" + + "Response headers: '%s'%n" + + "Response entity: '%s'", + response.getStatusLine().getStatusCode(), id, cachePage, + request, + Arrays.toString(request.getAllHeaders()), + response, + response.getStatusLine(), + Arrays.toString(response.getAllHeaders()), + EntityUtils.toString(response.getEntity())); + log.error(message); continue; } @@ -232,4 +245,4 @@ private byte[] decrypt(byte[] cipherText, String encryptionKey, byte[] IV) throw return cipher.doFinal(cipherText); } -} \ No newline at end of file +}