Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Error Logging

Error Logging

Scheduled Pinned Locked Moved C#
helpquestionbeta-testingregextutorial
8 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    CodingYoshi
    wrote on last edited by
    #1

    I was wondering what you do when you are logging errors and providing error messages during dev, qa, uat and then production. For example, for qa I provide a message to include a guid with their ticket. I provide them the guid. I then use this guid to look up the error message in the log and see what the issue was. The error messages will change once it goes to production as it will not make sense to ask users to include the guid with their ticket. You simply tell them something went wrong or if they can fix it, tell them what they can do. The question is: What is the best practice to use to change error reporting based on qa, uat and production phases? Here are some ideas I have: 1. I can read from config file for the phase and provide errors accordingly 2. I can have a preprocessor directive defined for each phase

    CodingYoshi Artificial Intelligence is no match for Human Stupidity.

    P L A 3 Replies Last reply
    0
    • C CodingYoshi

      I was wondering what you do when you are logging errors and providing error messages during dev, qa, uat and then production. For example, for qa I provide a message to include a guid with their ticket. I provide them the guid. I then use this guid to look up the error message in the log and see what the issue was. The error messages will change once it goes to production as it will not make sense to ask users to include the guid with their ticket. You simply tell them something went wrong or if they can fix it, tell them what they can do. The question is: What is the best practice to use to change error reporting based on qa, uat and production phases? Here are some ideas I have: 1. I can read from config file for the phase and provide errors accordingly 2. I can have a preprocessor directive defined for each phase

      CodingYoshi Artificial Intelligence is no match for Human Stupidity.

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #2

      I'm not keen on this idea because you aren't testing like for like code (and yes, testing exception handling is testing the code). In other words, each environment is required to behave differently, which means that you cannot be 100% confident that your code will behave correctly as you haven't tested it in the previous environment.

      *pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

      "Mind bleach! Send me mind bleach!" - Nagy Vilmos

      CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier

      C 1 Reply Last reply
      0
      • P Pete OHanlon

        I'm not keen on this idea because you aren't testing like for like code (and yes, testing exception handling is testing the code). In other words, each environment is required to behave differently, which means that you cannot be 100% confident that your code will behave correctly as you haven't tested it in the previous environment.

        *pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

        "Mind bleach! Send me mind bleach!" - Nagy Vilmos

        CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier

        C Offline
        C Offline
        CodingYoshi
        wrote on last edited by
        #3

        Point taken! I was looking for more ideas from everyone else and assumed my idea was not the best approach. Can you provide some ideas about how you handle such? I am using Log4Net if that matters. I am pretty sure I am not the first to come across this.

        CodingYoshi Artificial Intelligence is no match for Human Stupidity.

        P 1 Reply Last reply
        0
        • C CodingYoshi

          Point taken! I was looking for more ideas from everyone else and assumed my idea was not the best approach. Can you provide some ideas about how you handle such? I am using Log4Net if that matters. I am pretty sure I am not the first to come across this.

          CodingYoshi Artificial Intelligence is no match for Human Stupidity.

          P Offline
          P Offline
          Pete OHanlon
          wrote on last edited by
          #4

          It really depends on what you are hooking into. If you are logging your errors into a database, then you could have a configuration in that database to identify the level of detail to provide, or you could have the actual error message in there. Supposing that the Guid that you display in QA is the identity of the logged error, then your message could be "There was an error logged with id {0}". Now, if you provide the Guid into this using string.Format and there's no {0} written there then the Guid wouldn't be written out in the error message - satisfying that criteria of not displaying unecessary info to the end user.

          *pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

          "Mind bleach! Send me mind bleach!" - Nagy Vilmos

          CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier

          1 Reply Last reply
          0
          • C CodingYoshi

            I was wondering what you do when you are logging errors and providing error messages during dev, qa, uat and then production. For example, for qa I provide a message to include a guid with their ticket. I provide them the guid. I then use this guid to look up the error message in the log and see what the issue was. The error messages will change once it goes to production as it will not make sense to ask users to include the guid with their ticket. You simply tell them something went wrong or if they can fix it, tell them what they can do. The question is: What is the best practice to use to change error reporting based on qa, uat and production phases? Here are some ideas I have: 1. I can read from config file for the phase and provide errors accordingly 2. I can have a preprocessor directive defined for each phase

            CodingYoshi Artificial Intelligence is no match for Human Stupidity.

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            CodingYoshi wrote:

            1. I can read from config file for the phase and provide errors accordingly
            2. I can have a preprocessor directive defined for each phase

            I'd recommend a unified way of phoning home; have every unexpected exception be automatically logged in the bugtracker, and have the bugtracker look up the actual phase of development. You could add in a conditional compile; adding some complexity that does not add much value to the end-product.

            Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]

            1 Reply Last reply
            0
            • C CodingYoshi

              I was wondering what you do when you are logging errors and providing error messages during dev, qa, uat and then production. For example, for qa I provide a message to include a guid with their ticket. I provide them the guid. I then use this guid to look up the error message in the log and see what the issue was. The error messages will change once it goes to production as it will not make sense to ask users to include the guid with their ticket. You simply tell them something went wrong or if they can fix it, tell them what they can do. The question is: What is the best practice to use to change error reporting based on qa, uat and production phases? Here are some ideas I have: 1. I can read from config file for the phase and provide errors accordingly 2. I can have a preprocessor directive defined for each phase

              CodingYoshi Artificial Intelligence is no match for Human Stupidity.

              A Offline
              A Offline
              Abhinav S
              wrote on last edited by
              #6

              You could think about using log4net - this will handle a lot of the logging framework for you. If you want you can turn off debugging logs in the production environment.

              Windows Phone Apps - XKCD | Calvin | SMBC | Dilbert | Speed Dial

              C 1 Reply Last reply
              0
              • A Abhinav S

                You could think about using log4net - this will handle a lot of the logging framework for you. If you want you can turn off debugging logs in the production environment.

                Windows Phone Apps - XKCD | Calvin | SMBC | Dilbert | Speed Dial

                C Offline
                C Offline
                CodingYoshi
                wrote on last edited by
                #7

                I am using Log4net as I have mentioned. How can I turn off debugging log? Please note one of the things I am trying to do is providing different error messages to users based on whether the product is in qa or production. In qa the user will be qa. In production it will be, obviously, a regular user.

                CodingYoshi Artificial Intelligence is no match for Human Stupidity.

                P 1 Reply Last reply
                0
                • C CodingYoshi

                  I am using Log4net as I have mentioned. How can I turn off debugging log? Please note one of the things I am trying to do is providing different error messages to users based on whether the product is in qa or production. In qa the user will be qa. In production it will be, obviously, a regular user.

                  CodingYoshi Artificial Intelligence is no match for Human Stupidity.

                  P Offline
                  P Offline
                  Pete OHanlon
                  wrote on last edited by
                  #8

                  Store your error messages in a database, and read them from there. I wouldn't recommend using resource files for this because it would mean that you have to do a different deploy between the environments.

                  *pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

                  "Mind bleach! Send me mind bleach!" - Nagy Vilmos

                  CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups