Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More verbose error logging for sysinf #204

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -40,6 +40,7 @@
import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Optional;

/**
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -232,4 +245,4 @@ private byte[] decrypt(byte[] cipherText, String encryptionKey, byte[] IV) throw
return cipher.doFinal(cipherText);
}

}
}