mirror of
https://github.com/winsw/winsw.git
synced 2025-12-10 18:37:28 +08:00
[FIXED JENKINS-10547] Don't fail fatally when unable to log event
This commit is contained in:
18
Main.cs
18
Main.cs
@@ -138,7 +138,14 @@ namespace winsw
|
||||
}
|
||||
else
|
||||
{
|
||||
EventLog.WriteEntry(message);
|
||||
try
|
||||
{
|
||||
EventLog.WriteEntry(message);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
WriteEvent("Failed to log event in Windows Event Log: " + message + "; Reason: ", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,7 +157,14 @@ namespace winsw
|
||||
}
|
||||
else
|
||||
{
|
||||
EventLog.WriteEntry(message, type);
|
||||
try
|
||||
{
|
||||
EventLog.WriteEntry(message, type);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
WriteEvent("Failed to log event in Windows Event Log. Reason: ", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user