diff --git a/src/main/java/org/javaswift/joss/command/impl/core/AbstractCommand.java b/src/main/java/org/javaswift/joss/command/impl/core/AbstractCommand.java index cc8ffeef..24f82fb3 100644 --- a/src/main/java/org/javaswift/joss/command/impl/core/AbstractCommand.java +++ b/src/main/java/org/javaswift/joss/command/impl/core/AbstractCommand.java @@ -55,9 +55,16 @@ public N call() { if (allowErrorLog) { // This is disabled, for example, for exists(), where we want to ignore the exception logError(request, err); } + logCall(response); + if(response != null && response.getAllHeaders() != null) { + LOG.error("Response Headers: "+Arrays.asList(response.getAllHeaders()).toString()); + } throw err; } catch (IOException err) { request.releaseConnection(); + if(response != null && response.getAllHeaders() != null) { + LOG.error("Response Headers: "+Arrays.asList(response.getAllHeaders()).toString()); + } throw new CommandException("Unable to execute the HTTP call or to convert the HTTP Response", err); } finally { if (closeStreamAutomatically()) { @@ -72,6 +79,10 @@ private void logCall(M request) { LOG.debug("* "+printableHeaderLine); } } + + private void logCall(HttpResponse response) { + LOG.debug("JOSS / Response Headers* "+Arrays.asList(response.getAllHeaders()).toString()); + } private void logError(M request, CommandException err) { LOG.error(