diff --git a/src/main/java/com/pingao/server/HttpRequestHandler.java b/src/main/java/com/pingao/server/HttpRequestHandler.java index 8d194fa..a9235b9 100644 --- a/src/main/java/com/pingao/server/HttpRequestHandler.java +++ b/src/main/java/com/pingao/server/HttpRequestHandler.java @@ -93,7 +93,7 @@ private static void send100Continue(ChannelHandlerContext ctx) { @Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) { - cause.printStackTrace(); + LOGGER.error("Error occurs cause", cause); ctx.close(); } } diff --git a/src/main/java/com/pingao/server/MarkDownServer.java b/src/main/java/com/pingao/server/MarkDownServer.java index 416c663..c83053f 100644 --- a/src/main/java/com/pingao/server/MarkDownServer.java +++ b/src/main/java/com/pingao/server/MarkDownServer.java @@ -66,7 +66,7 @@ public ChannelFuture start(int port) { future.syncUninterruptibly(); channel = future.channel(); isRunning = true; - LOGGER.info("Markdown server is running..."); + LOGGER.info("Markdown server is running on {} ...", channel.localAddress()); return future; } @@ -74,7 +74,7 @@ public void destroy() { channel.close(); channelGroup.close(); group.shutdownGracefully(); - LOGGER.info("Server shutdown success"); + LOGGER.info("Markdown server shutdown success"); } public boolean isRunning() { diff --git a/src/main/java/com/pingao/server/SocketServer.java b/src/main/java/com/pingao/server/SocketServer.java index fdf65a6..4bc63d1 100644 --- a/src/main/java/com/pingao/server/SocketServer.java +++ b/src/main/java/com/pingao/server/SocketServer.java @@ -44,6 +44,7 @@ public void initChannel(SocketChannel ch) { }); ChannelFuture f = b.bind().sync(); + LOGGER.info("Socket server is running on {} ...", f.channel().localAddress()); f.channel().closeFuture().sync(); } finally { group.shutdownGracefully().sync(); @@ -80,9 +81,8 @@ public void channelRead(ChannelHandlerContext ctx, Object msg) { } @Override - public void exceptionCaught(ChannelHandlerContext ctx, - Throwable cause) { - cause.printStackTrace(); + public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) { + LOGGER.error("Error occurs cause", cause); ctx.close(); } }