How much information should be logged from errors?

At the company I work for, I created the Error Logging class to handle errors in my ASP.net application. This is a custom class because we are not allowed to install additional software on our servers (nLog, log4net, etc.).

Currently, I use it in two of my projects and see good results. Right now I am catching errors causing page and application errors. It sends and saves an error message and all internal exceptions.

The problem that I am facing right now, I get errors that I'm not quite sure how to reproduce. I have not heard error messages from any of my users. I'm not sure what they are doing, or even if they see mistakes in them.

I am thinking of creating an event log on every page or those on which I want more information. Saving it as a session variable on the page and recording events in it (beginning / end of functions, changing variables, etc.). Then only if an error is sent with the sending along with the error message to find out if it gives a better idea of ​​what is happening. I hope that this will not give me many event logs when all users access the application, I just want this to happen right before the error occurred with one user.

Do you know about any pitfalls that I should observe using the method?

Do you have any tips for finding things?

Update:

@Saret: I understand where you came from, and I agree. I am new to this company and still need to find out how they do it. I used to have conversations with my colleagues, it would be great to have this product or use this open source project. The problem boils down to the fact that we are working on secure systems and getting permission to get these things, it takes a lot of time, the top cover and work with all the red tape. I will consider the situation further, because I believe that having a good error reporting system in place is important, nothing is currently being used.

@Jim Blizard: / -, , , . , , . , , Page_Error , . , /, . , , , , .

@Roberto Barros: , , -, .

+3
5

, , , ( ), ?

, , , ? ? , , , - .

+3

- , -, () COM-. , , log4net .

, log4net, .

+2

asp.net ( ):

  • protected void Application_Error(object sender, EventArgs e) { Server.Transfer("~/Support/ServerErrorSupport.aspx", true); } ( a Server.Transfer .)

  • , ( ). - , , : , , . . , lineNr .

  • xml ( , -, = > ToString(), ISerializable = > serialize,...):

    • MachineName: Application.Server.MachineName
    • PhysicalRoot: Application.Server.MapPath( "~/" )
    • RequestUrl: Application.Request.Url.ToString()
    • ApplicationSettings: WebConfigurationManager.AppSettings
    • ConnectionSettings: WebConfigurationManager.ConnectionStrings
    • QueryString: Application.Request.QueryString
    • FormPost: Application.Request.Form
    • : Application.Session
    • HttpHeaders: Application.Request.Headers
  • xml , . , :

    • rapport (xml ) ( / )
    • - ( hd), (, , db ..), , .
    • , servererrorsupport.aspx xml . XML-.
    • xslt (xml) .
+2

LOT. , . ( ) .

+1

:

  • / (, , , ..)
  • ( )
  • ( )
  • (, , ..)

- , . Windows. , . ... .

: , , , , ... (IIRC).

+1

All Articles