mirror of https://github.com/winsw/winsw
[FIXED JENKINS-10547] Don't fail fatally when unable to log event
parent
d0d4266af2
commit
220eff2ac3
14
Main.cs
14
Main.cs
|
@ -137,9 +137,16 @@ namespace winsw
|
||||||
/* NOP - cannot call EventLog because of shutdown. */
|
/* NOP - cannot call EventLog because of shutdown. */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
EventLog.WriteEntry(message);
|
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)
|
public void LogEvent(String message, EventLogEntryType type)
|
||||||
|
@ -149,9 +156,16 @@ namespace winsw
|
||||||
/* NOP - cannot call EventLog because of shutdown. */
|
/* NOP - cannot call EventLog because of shutdown. */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
EventLog.WriteEntry(message, type);
|
EventLog.WriteEntry(message, type);
|
||||||
}
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
WriteEvent("Failed to log event in Windows Event Log. Reason: ", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void WriteEvent(Exception exception)
|
private void WriteEvent(Exception exception)
|
||||||
|
|
Loading…
Reference in New Issue