From 6a0938d8f6fdf9dbc45f03384a3cd83efeef022c Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Fri, 15 Oct 2010 15:35:45 +0200 Subject: [PATCH] Stop logging when starting the plugin failed. --- .../java/net/pterodactylus/sone/main/SonePlugin.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/pterodactylus/sone/main/SonePlugin.java b/src/main/java/net/pterodactylus/sone/main/SonePlugin.java index b253d41..810fef1 100644 --- a/src/main/java/net/pterodactylus/sone/main/SonePlugin.java +++ b/src/main/java/net/pterodactylus/sone/main/SonePlugin.java @@ -145,8 +145,21 @@ public class SonePlugin implements FredPlugin, FredPluginL10n, FredPluginBaseL10 core.freenetInterface(freenetInterface); /* start core! */ - core.start(); - webInterface.start(); + boolean startupFailed = true; + try { + core.start(); + webInterface.start(); + startupFailed = false; + } finally { + if (startupFailed) { + /* + * we let the exception bubble up but shut the logging down so + * that the logfile is not swamped by the installed logging + * handlers of the failed instances. + */ + Logging.shutdown(); + } + } } /** -- 2.7.4