[FIXED JENKINS-10547] Don't fail fatally when unable to log event

pull/49/head
Daniel Beck 2014-09-07 01:19:11 +02:00
parent d0d4266af2
commit 220eff2ac3
1 changed files with 16 additions and 2 deletions

14
Main.cs
View File

@ -137,9 +137,16 @@ namespace winsw
/* NOP - cannot call EventLog because of shutdown. */
}
else
{
try
{
EventLog.WriteEntry(message);
}
catch (Exception e)
{
WriteEvent("Failed to log event in Windows Event Log: " + message + "; Reason: ", e);
}
}
}
public void LogEvent(String message, EventLogEntryType type)
@ -149,9 +156,16 @@ namespace winsw
/* NOP - cannot call EventLog because of shutdown. */
}
else
{
try
{
EventLog.WriteEntry(message, type);
}
catch (Exception e)
{
WriteEvent("Failed to log event in Windows Event Log. Reason: ", e);
}
}
}
private void WriteEvent(Exception exception)