Hi,

I'm running Fred as a service in the background, and so won't see
exceptions that are not logged. The most likely culprits are fatal
datastore corruptions. All I see is that Fred is no longer running
after a boot.

So to get more information, I wrote code to catch unhandled exceptions
in the main class, and log them. I think it's useful, and applied it
to the Debian package. Would be fine if you could use this or a
similar mechanism ... most other exceptions /are/ logged after all.

Here's the patch:

diff -Nur freenet-unstable-0.4.3+20020815/src/freenet/node/Main.java freenet-unstable-0.4.3+20020815+/src/freenet/node/Main.java
--- freenet-unstable-0.4.3+20020815/src/freenet/node/Main.java	2002-08-15 17:25:01.000000000 +0200
+++ freenet-unstable-0.4.3+20020815+/src/freenet/node/Main.java	2002-08-24 15:02:33.000000000 +0200
@@ -505,6 +505,16 @@
                                +" to bind to a port < 1024.");
             System.exit(1);
         }
+	catch (Exception e) {
+	    ByteArrayOutputStream s = new ByteArrayOutputStream();
+	    PrintStream ps = new PrintStream(s);
+	    e.printStackTrace(ps);
+	    ps.flush();
+	    Core.logger.log(Main.class, "Unexpected Exception: "
+			    +e.getClass().getName()+"\n"+s.toString(),
+			    Logger.ERROR);
+	    throw e;
+	}
         finally {
             Core.randSource.close();
         }

-- 
Robbe

Attachment: signature.ng
Description: PGP signature

Reply via email to