With Better Logger

This commit is contained in:
egmp777 2014-05-23 17:46:27 -05:00
parent 4bd671cdb7
commit 0e09022a00
1 changed files with 7 additions and 3 deletions

View File

@ -11,6 +11,8 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.http.HttpEntity;
import org.apache.http.HttpStatus;
@ -34,6 +36,7 @@ public class HttpClientMultipartTest {
private static final String textFileName = "temp.txt";
private static final String imageFileName = "image.jpg";
private static final String zipFileName = "zipFile.zip";
private static final Logger LOGGER = Logger.getLogger("org.baeldung.httpclient.HttpClientMultipartTest");
private CloseableHttpClient client;
private HttpPost post;
private BufferedReader rd;
@ -44,7 +47,6 @@ public class HttpClientMultipartTest {
public final void before() {
client = HttpClientBuilder.create().build();
post = new HttpPost(SERVER);
log = java.util.logging.Logger.getAnonymousLogger();
}
@After
@ -53,12 +55,14 @@ public class HttpClientMultipartTest {
try {
client.close();
} catch (final IOException e1) {
log.throwing("HttpClientMultipartTest", "after()", e1);
LOGGER.log(Level.SEVERE, e1.getMessage(), e1);
throw e1;
}
try {
rd.close();
} catch (final IOException e) {
log.throwing("HttpClientMultipartTest", "after()", e);
LOGGER.log(Level.SEVERE, e.getMessage(), e);
throw e;
}
try {
final HttpEntity entity = response.getEntity();