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