locked
Error Logging - what to store and where to store RRS feed

  • Question

  • User1396448631 posted

    I would really appreciate if some of you can comment from your company's experience on how and what do you log in your web applications.

    We are an extremely small team. We have close to 20 .net apps of medium size. Not consistent but many of them use log4net.

    We would like to revamp our error handling. May be have a dashboard storing errors of all the apps.

    To achieve this, we plan to have a SQL table with following columns

    • ID
    • ApplicationName
    • IPAddress
    • ErrorMessage
    • ErrorStackTrace
    • ErrorDateTime

    We plan to use error email mechanism whenever an exception is raised.

    Just looking forward to know the logging infrastructure you guys have in your team.

    Thank you.

    Wednesday, February 5, 2020 3:13 PM

Answers

  • User1120430333 posted

    Yes, you can do all that you are talking about. However, I suggest that you use Localdb for a  MS SQL Server detached MDF file from the database engine for MS SQL Server hosted by the server, in case it goes down. The detached MDF file using Localdb would be on a per application basis. A lot of the free 3rd party logging frameworks like Log4NET and others have built-in database technology to log to a custom database table for logging.

    You should also think about using global exception handling to eliminate try/catches all over the code.

    https://stackify.com/csharp-catch-all-exceptions/

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, February 5, 2020 7:53 PM

All replies

  • User1120430333 posted

    Yes, you can do all that you are talking about. However, I suggest that you use Localdb for a  MS SQL Server detached MDF file from the database engine for MS SQL Server hosted by the server, in case it goes down. The detached MDF file using Localdb would be on a per application basis. A lot of the free 3rd party logging frameworks like Log4NET and others have built-in database technology to log to a custom database table for logging.

    You should also think about using global exception handling to eliminate try/catches all over the code.

    https://stackify.com/csharp-catch-all-exceptions/

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, February 5, 2020 7:53 PM
  • User379720387 posted

    I use Elmah for raising the exceptions and looking at the error pages after the fact. Elmah fills a SQL CE table

    NLog for to be able to follow the flow of things within functionality groups, or to see how users move through the app

    Twilio SMS for something that needs immediate attention.

    Friday, February 7, 2020 4:21 PM
  • User-35771671 posted

    While you are already revamping everything, did you consider using a cloud-based platform. There are a lot of projects out there, that specialize in collecting log data through log4net (and other logging frameworks) and presenting them in a nice way. Here's a few: elmah.io, Loggly, and Logentries.

    Friday, February 7, 2020 6:10 PM