Skip to content

Commit 823cc92

Browse files
committed
Don't use System.err for logging
1 parent 814c81c commit 823cc92

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

client/src/test/java/org/asynchttpclient/reactivestreams/HttpStaticFileServerHandler.java

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
*/
1616
package org.asynchttpclient.reactivestreams;
1717

18+
import static io.netty.handler.codec.http.HttpHeaders.Names.*;
19+
import static io.netty.handler.codec.http.HttpMethod.GET;
20+
import static io.netty.handler.codec.http.HttpResponseStatus.*;
21+
import static io.netty.handler.codec.http.HttpVersion.HTTP_1_1;
1822
import io.netty.buffer.ByteBuf;
1923
import io.netty.buffer.Unpooled;
2024
import io.netty.channel.ChannelFuture;
@@ -36,6 +40,7 @@
3640
import io.netty.handler.ssl.SslHandler;
3741
import io.netty.handler.stream.ChunkedFile;
3842
import io.netty.util.CharsetUtil;
43+
3944
import java.io.File;
4045
import java.io.FileNotFoundException;
4146
import java.io.RandomAccessFile;
@@ -48,13 +53,12 @@
4853
import java.util.Locale;
4954
import java.util.TimeZone;
5055
import java.util.regex.Pattern;
56+
5157
import javax.activation.MimetypesFileTypeMap;
52-
import org.asynchttpclient.test.TestUtils;
5358

54-
import static io.netty.handler.codec.http.HttpHeaders.Names.*;
55-
import static io.netty.handler.codec.http.HttpMethod.GET;
56-
import static io.netty.handler.codec.http.HttpResponseStatus.*;
57-
import static io.netty.handler.codec.http.HttpVersion.HTTP_1_1;
59+
import org.asynchttpclient.test.TestUtils;
60+
import org.slf4j.Logger;
61+
import org.slf4j.LoggerFactory;
5862

5963

6064
/**
@@ -105,6 +109,7 @@
105109
*/
106110
public class HttpStaticFileServerHandler extends SimpleChannelInboundHandler<FullHttpRequest> {
107111

112+
private static final Logger LOGGER = LoggerFactory.getLogger(HttpStaticFileServerHandler.class);
108113
public static final String HTTP_DATE_FORMAT = "EEE, dd MMM yyyy HH:mm:ss zzz";
109114
public static final String HTTP_DATE_GMT_TIMEZONE = "GMT";
110115
public static final int HTTP_CACHE_SECONDS = 60;
@@ -204,15 +209,15 @@ public void channelRead0(ChannelHandlerContext ctx, FullHttpRequest request) thr
204209
@Override
205210
public void operationProgressed(ChannelProgressiveFuture future, long progress, long total) {
206211
if (total < 0) { // total unknown
207-
System.err.println(future.channel() + " Transfer progress: " + progress);
212+
LOGGER.info(future.channel() + " Transfer progress: " + progress);
208213
} else {
209-
System.err.println(future.channel() + " Transfer progress: " + progress + " / " + total);
214+
LOGGER.info(future.channel() + " Transfer progress: " + progress + " / " + total);
210215
}
211216
}
212217

213218
@Override
214219
public void operationComplete(ChannelProgressiveFuture future) {
215-
System.err.println(future.channel() + " Transfer complete.");
220+
LOGGER.info(future.channel() + " Transfer complete.");
216221
}
217222
});
218223

0 commit comments

Comments
 (0)