diff --git a/aws/core/src/test/resources/log4j.xml b/aws/core/src/test/resources/log4j.xml
new file mode 100644
index 0000000000..dd65a0cc6c
--- /dev/null
+++ b/aws/core/src/test/resources/log4j.xml
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/aws/pom.xml b/aws/pom.xml
index 116da38d10..79db1f6ede 100644
--- a/aws/pom.xml
+++ b/aws/pom.xml
@@ -58,6 +58,18 @@
test-jar
test
+
+ log4j
+ log4j
+ 1.2.14
+ test
+
+
+ ${project.groupId}
+ jclouds-log4j
+ ${project.version}
+ test
+
diff --git a/aws/s3/core/src/test/java/org/jclouds/aws/s3/S3IntegrationTest.java b/aws/s3/core/src/test/java/org/jclouds/aws/s3/S3IntegrationTest.java
index 7f68c3256d..d2d64e35ac 100644
--- a/aws/s3/core/src/test/java/org/jclouds/aws/s3/S3IntegrationTest.java
+++ b/aws/s3/core/src/test/java/org/jclouds/aws/s3/S3IntegrationTest.java
@@ -54,6 +54,7 @@ import org.jclouds.aws.s3.internal.StubS3Connection;
import org.jclouds.aws.s3.reference.S3Constants;
import org.jclouds.aws.s3.util.S3Utils;
import org.jclouds.http.config.JavaUrlHttpFutureCommandClientModule;
+import org.jclouds.logging.log4j.config.Log4JLoggingModule;
import org.jclouds.util.Utils;
import org.testng.ITestContext;
import org.testng.annotations.AfterGroups;
@@ -218,7 +219,7 @@ public class S3IntegrationTest {
protected void createLiveS3Context(String AWSAccessKeyId, String AWSSecretAccessKey) {
context = buildS3ContextFactory(AWSAccessKeyId, AWSSecretAccessKey).withModule(
- createHttpModule()).build();
+ createHttpModule()).withModule(new Log4JLoggingModule()).build();
}
public String getBucketName() throws InterruptedException, ExecutionException, TimeoutException {
diff --git a/core/src/main/java/org/jclouds/http/internal/BaseHttpFutureCommandClient.java b/core/src/main/java/org/jclouds/http/internal/BaseHttpFutureCommandClient.java
index 32bc863377..c14ece91fc 100644
--- a/core/src/main/java/org/jclouds/http/internal/BaseHttpFutureCommandClient.java
+++ b/core/src/main/java/org/jclouds/http/internal/BaseHttpFutureCommandClient.java
@@ -61,34 +61,37 @@ public abstract class BaseHttpFutureCommandClient implements HttpFutureComman
public void submit(HttpFutureCommand> command) {
HttpRequest request = command.getRequest();
- Q nativeRequest = null;
try {
HttpResponse response = null;
for (;;) {
- logger.trace("%s - converting request %s", request.getEndPoint(), request);
- for (HttpRequestFilter filter : requestFilters) {
- filter.filter(request);
- }
- nativeRequest = convert(request);
- response = invoke(nativeRequest);
- int statusCode = response.getStatusCode();
- if (statusCode >= 300) {
- if (retryHandler.shouldRetryRequest(command, response)) {
- continue;
+ Q nativeRequest = null;
+ try {
+ logger.trace("%s - converting request %s", request.getEndPoint(), request);
+ for (HttpRequestFilter filter : requestFilters) {
+ filter.filter(request);
+ }
+ nativeRequest = convert(request);
+ response = invoke(nativeRequest);
+ int statusCode = response.getStatusCode();
+ if (statusCode >= 300) {
+ if (retryHandler.shouldRetryRequest(command, response)) {
+ continue;
+ } else {
+ errorHandler.handleError(command, response);
+ break;
+ }
+
} else {
- errorHandler.handleError(command, response);
+ processResponse(response, command);
break;
}
- } else {
- processResponse(response, command);
- break;
+ } finally {
+ cleanup(nativeRequest);
}
}
} catch (Exception e) {
command.setException(new ExecutionException(String.format("error invoking request %s",
request), e));
- } finally {
- cleanup(nativeRequest);
}
}
diff --git a/core/src/main/java/org/jclouds/http/internal/JavaUrlHttpFutureCommandClient.java b/core/src/main/java/org/jclouds/http/internal/JavaUrlHttpFutureCommandClient.java
index 723a008511..cc2556c5ac 100644
--- a/core/src/main/java/org/jclouds/http/internal/JavaUrlHttpFutureCommandClient.java
+++ b/core/src/main/java/org/jclouds/http/internal/JavaUrlHttpFutureCommandClient.java
@@ -57,10 +57,10 @@ public class JavaUrlHttpFutureCommandClient extends BaseHttpFutureCommandClient<
@Override
protected HttpResponse invoke(HttpURLConnection connection) throws IOException {
- HttpResponse response = new HttpResponse();
if (logger.isTraceEnabled())
- logger.trace("%1$s - submitting request %2$s, headers: %3$s", connection.getURL()
- .getHost(), connection.getURL(), connection.getRequestProperties());
+ logger.trace("%1$s - submitting request %2$s", connection.getURL().getHost(), connection
+ .getURL());
+ HttpResponse response = new HttpResponse();
InputStream in;
try {
in = connection.getInputStream();
@@ -132,5 +132,4 @@ public class JavaUrlHttpFutureCommandClient extends BaseHttpFutureCommandClient<
if (connection != null && connection.getContentLength() == 0)
connection.disconnect();
}
-
}