From cd36390e35105a2f1a7d7c84d334b05a92df46bf Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sat, 16 Mar 2013 18:19:40 +0100 Subject: [PATCH] Add logging. --- src/main/java/net/pterodactylus/sonitus/data/Connection.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/net/pterodactylus/sonitus/data/Connection.java b/src/main/java/net/pterodactylus/sonitus/data/Connection.java index 9377579..8ea1a55 100644 --- a/src/main/java/net/pterodactylus/sonitus/data/Connection.java +++ b/src/main/java/net/pterodactylus/sonitus/data/Connection.java @@ -18,6 +18,8 @@ package net.pterodactylus.sonitus.data; import java.io.IOException; +import java.util.logging.Level; +import java.util.logging.Logger; /** * A connection reads bytes from a {@link Source} and feeds it to a sink. This @@ -31,6 +33,9 @@ import java.io.IOException; */ public abstract class Connection implements Runnable { + /** The logger. */ + private static final Logger logger = Logger.getLogger(Connection.class.getName()); + /** The source to consume. */ private final Source source; @@ -55,10 +60,12 @@ public abstract class Connection implements Runnable { byte[] buffer = source.get(bufferSize()); feed(buffer); } catch (IOException ioe1) { + logger.log(Level.WARNING, "Sink died!", ioe1); break; } } try { + logger.info("Connection finished."); finish(); } catch (IOException ioe1) { /* well, what can we do? nothing. */ -- 2.7.4