添加异常日志打印
This commit is contained in:
parent
2058b1db15
commit
994fc8dc2c
@ -22,12 +22,17 @@ namespace WebSocketTool
|
||||
protected override void OnStartup(StartupEventArgs e)
|
||||
{
|
||||
base.OnStartup(e);
|
||||
LogManager.GetManager().Init("WebSocketTool");
|
||||
XmlConfigurator.ConfigureAndWatch(new FileInfo("log4net.config"));
|
||||
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
|
||||
Directory.CreateDirectory("log");
|
||||
LogManager.GetManager().Init("WebSocketTool");
|
||||
log = LogManager.GetManager().GetLog(nameof(App));
|
||||
}
|
||||
|
||||
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
|
||||
{
|
||||
log.Error($"app crash:{e.ExceptionObject}");
|
||||
}
|
||||
|
||||
public static void RunOnUIThread(Action action)
|
||||
{
|
||||
if (Current == null)
|
||||
|
@ -104,7 +104,7 @@ namespace WebSocketTool.Util
|
||||
log.Warn(msg);
|
||||
}
|
||||
|
||||
public void Error(string msg, Exception e)
|
||||
public void Error(string msg, Exception e = null)
|
||||
{
|
||||
log.Error(msg, e);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user