From: David Roden Date: Tue, 14 Oct 2014 12:17:37 +0000 (+0200) Subject: Log an exception with a stack trace when a connection is disconnected. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=790f4e1ba05bcc2570f4d3f1a66bf7e5f213accb;p=jSite.git Log an exception with a stack trace when a connection is disconnected. Hopefully this will help with diagnosing Fred[1]’s problems. [1]: sone://gsoMVNQRVEA6ekBxMBtaTkgP7DjiCiFAetW6MekgEbE --- 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(); }