2012-03-16 50 views
1

我有一個關於appharbor的網站。如何在AppHarbor中記錄unhandeled異常?

我知道有一些logentries需要登錄。

但是,如何查看所有未處理的服務器端異常?

我發現這個片段(把int Global.ascx),但找不到什麼是所需的所有dll引用。

protected void Application_Error(object sender, EventArgs e) 
{ 
    try 
    { 
     var exception = Server.GetLastError(); 
     var logEntry = new LogEntry 
     { 
      Date = DateTime.Now, 
      Message = exception.Message, 
      StackTrace = exception.StackTrace, 
     }; 

     var datacontext = new LogDBDataContext(); 
     datacontext.LogEntries.InsertOnSubmit(logEntry); 
     datacontext.SubmitChanges(); 
    } 
    catch (Exception) 
    { 
     // failed to record exception 
    } 
} 

回答