110,559
社区成员
发帖
与我相关
我的任务
分享
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
var msg = e.ExceptionObject.ToString();
var ss = string.Format("{0}发生系统异常。\r\n{1}\r\n\r\n\r\n", DateTime.Now, msg);
File.AppendAllText(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "系统异常.log"), ss);
}