I've come across a problem that doesn't occur in our development environment or test environment, but does occur in our production environment.

Obviously, this environment is pretty locked down, and all the code is compiled.

Are there any tips on how to debug problems with back end code in a production environment?

If possible, I want to steer clear from debug messages on the front-end, although we can do this if needed.

  • 2
    Hello Jessica, and welcome. I would just like to point out that, if you're looking for specific recommendations, you should at least include in your question which technologies you're using. If you're in Microsoft land, for instance, there are ways to debug e.g. an ASP.NET app running on a remote machine from within VS (in which case Google will be your friend). I've never done it myself, but I think you would need to install some tools on the remote machine, which may or may not be feasible in your particular situation. – s.m Oct 4 '18 at 15:33

The short answer is to add debug statements to write to a log file.

Make sure you're not logging sensitive data and make sure you have a mechanism to manage your log files. It's a good idea to use an existing logging solution such as log4net, log4j, etc. rather than making your own.

| improve this answer | |
  • 1
    One addition: when introducing logging statements, make sure to use the appropriate log levels like ERROR, WARNING, INFO, DEBUG etc. In your case, I'd recommend ERROR when some self-check detected the problem (maybe caught an exception), and DEBUG for the step-by-step outputs on the (most likely) path to the problem. Then later, you can switch off the debugging outputs by just changing the log threshold, but still keep error reporting. – Ralf Kleberhoff Oct 4 '18 at 20:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.