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. */
|
||||
}
|
||||
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)
|
||||
|
|
Loading…
Reference in New Issue