From a8ac8d749e329b8bc7ba40a4ba016b1d96f35897 Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Wed, 14 Jun 2017 03:40:43 -0400 Subject: [PATCH] Adds logging for shutdown errors (#45) * Adds logging for startup and shutdown errors * You aren't doing the thing I asked * Remove this * Just this --- TGServerService/ServerService.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/TGServerService/ServerService.cs b/TGServerService/ServerService.cs index 6f863b31f0..1ddfe0a5d2 100644 --- a/TGServerService/ServerService.cs +++ b/TGServerService/ServerService.cs @@ -10,20 +10,20 @@ namespace TGServerService { public partial class TGServerService : ServiceBase { - static TGServerService ActiveService; //So everyone else can write to our eventlog + static TGServerService ActiveService; //So everyone else can write to our eventlog public static void WriteLog(string message, EventLogEntryType type = EventLogEntryType.Information) { ActiveService.EventLog.WriteEntry(message, type); } - + public static void LocalStop() { ThreadPool.QueueUserWorkItem(_ => { ActiveService.Stop(); }); } ServiceHost host; //the WCF host - + //you should seriously not add anything here //Use OnStart instead public TGServerService() @@ -82,7 +82,10 @@ namespace TGServerService host.Close(); //where TGStationServer.Dispose() is called host = null; } - catch { } + catch (Exception e) + { + WriteLog(e.ToString(), EventLogEntryType.Error); + } } } }