From: David ‘Bombe’ Roden Date: Sat, 16 Mar 2013 17:19:40 +0000 (+0100) Subject: Add logging. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=cd36390e35105a2f1a7d7c84d334b05a92df46bf;p=sonitus.git Add logging. --- 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. */