Tracking errors in real-time / production web applications

I currently work for a company that has many custom applications created internally. There are currently no standards for many things. I would like to implement a way to record / track errors that occur in these programs (most of them are asp.net).

I am currently thinking of handling this in Global.asax in an application error method. First try to save the information in the error / tracking log database, and if that fails, try sending an email.

What type of information is most useful for receiving error messages and other application variables (page, username, etc.).

I am currently thinking of using two tables, one for general information about errors and applications, and the second for information about exceptions. It will be a one-to-many relationship to pass internal Exceptions that may come from one application-level exception.

I’m sure that I don’t have enough details and would like to hear your strategy for solving this problem.

+3
source share
10 answers

Jeff Atwood wrote a great exception handler that you should look at CodeProject

I tried to collect as much information as possible. Stack Information Session Information Error Location

I would also install a web service that applications access to store exception information on your system.

+1

, ELMAH , .

+3

(, Log4Net), , , , .., . post , .

ASP.NET.

EDIT: , ELMAH, ASP.NET "" .

+2

, , - .

, , , , , !

, , bugs@mydomain.com

: [ ] [ : ddmmyyyy hhmmss] : , , , , Referrer.

ASP.NET , , , .

, , , , ( ), XML [errorLog_ mmm_yyyy.xml], "" gridview, XML , .

try 
{
   // production code
}
catch(Exception ex)
{
   Utilities.Mail.SendError(ex);
}

: Application_Error global.asax:

<%@ Application Language="C#" %>
<%@ Import Namespace="System.Diagnostics" %>
<script language="C#" runat="server">
void Application_Error(object sender, EventArgs e)
{
   //get reference to the source of the exception chain
   Exception ex = Server.GetLastError().GetBaseException();

   //log the details of the exception and page state to the
   //Windows Event Log
   EventLog.WriteEntry("myWebApplication name",
     "MESSAGE: " + ex.Message + 
     "\nSOURCE: " + ex.Source +
     "\nFORM: " + Request.Form.ToString() + 
     "\nQUERYSTRING: " + Request.QueryString.ToString() +
     "\nTARGETSITE: " + ex.TargetSite +
     "\nSTACKTRACE: " + ex.StackTrace, 
     EventLogEntryType.Error);

   Utilities.Mail.SendError(ex);
}
</script>

, XML SendError (Exception).

+1

, https. , ( ). , .

, , , , , ( ASPNET), , , /, ..

, - , (, ). .

, HTTPS, , , , . , , .

+1

, .

-, , , , , db .., , .

, , , , .

(, , , ), , .

, , , . .

0

Log.txt. , -, .

- , . .

, , (ID, , ), , ( , , ) , ( , , ). SQL. ( ..). DisplayMessage InternalMessage. DisplayMessage . InternalMessage .

Page_Error Application_Error.

key-value web.config, ( ). vaue, . , . , , . web.config.

0

, .

: CALM

0

-, , Clearwind Consulting. , . , ​​ , , , , , , 30 . Clearwind -. , , -.

, . RSS, , , . , iPhone, . Django, JSON, RoR, XML, CSV .., . .

, www.areciboapp.com.

, ( ) - , , 404. . , . , .

0
source

It is a very good idea to log in to a custom event log on the server, as well as for any other logging and notification. If an error occurs due to a problem with the infrastructure, the same problem can also cause the error handler to send e-mail or save it to the database.

0
source

Source: https://habr.com/ru/post/1698709/


All Articles