From: David ‘Bombe’ Roden Date: Fri, 15 Oct 2010 13:35:45 +0000 (+0200) Subject: Stop logging when starting the plugin failed. X-Git-Tag: 0.1-RC1~336 X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=commitdiff_plain;h=6a0938d8f6fdf9dbc45f03384a3cd83efeef022c Stop logging when starting the plugin failed. --- 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(); + } + } } /**