From 790f4e1ba05bcc2570f4d3f1a66bf7e5f213accb Mon Sep 17 00:00:00 2001 From: David Roden Date: Tue, 14 Oct 2014 14:17:37 +0200 Subject: [PATCH] Log an exception with a stack trace when a connection is disconnected. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Hopefully this will help with diagnosing Fred[1]’s problems. [1]: sone://gsoMVNQRVEA6ekBxMBtaTkgP7DjiCiFAetW6MekgEbE --- src/main/java/de/todesbaum/util/freenet/fcp2/Connection.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/de/todesbaum/util/freenet/fcp2/Connection.java b/src/main/java/de/todesbaum/util/freenet/fcp2/Connection.java index ff11cdf..ea40d1f 100644 --- a/src/main/java/de/todesbaum/util/freenet/fcp2/Connection.java +++ b/src/main/java/de/todesbaum/util/freenet/fcp2/Connection.java @@ -18,6 +18,9 @@ package de.todesbaum.util.freenet.fcp2; +import static java.util.logging.Level.FINE; +import static java.util.logging.Logger.getLogger; + import java.io.File; import java.io.FileOutputStream; import java.io.IOException; @@ -29,6 +32,7 @@ import java.net.Socket; import java.nio.charset.Charset; import java.util.ArrayList; import java.util.List; +import java.util.logging.Logger; import net.pterodactylus.util.io.Closer; import net.pterodactylus.util.io.StreamCopier; @@ -44,6 +48,8 @@ import de.todesbaum.util.io.TempFileInputStream; */ public class Connection { + private static final Logger logger = getLogger(Connection.class.getName()); + /** The listeners that receive events from this connection. */ private List connectionListeners = new ArrayList(); @@ -227,6 +233,7 @@ public class Connection { synchronized (this) { notify(); } + logger.log(FINE, "Connection terminated.", new Exception()); fireConnectionTerminated(); } -- 2.7.4