How to log exceptions in release mode

Stack tracing is not enabled when the .net assembly is deployed in release mode. Thus, we cannot get the stack trace from the exception and register it in the production environment.

To find out where the exception occurred in the production code and register it, we use a strange approach that I don’t like, but I can’t come up with a better solution that records the exact method in which the exception occurred in the first place.

Please note that the logging mechanism is also used to detect errors. Therefore, when a NullReferenceException or IndexOutOfBoundsException occurs, getting the type of exception and message is impractical, we often need to know where exactly the exception occurred.

How do you deal with this? What information do you register in your production code when an exception occurs and how do you determine that the problem is in this information?

+3
source share
3 answers

Check out ELMAH, I did not implement it myself, but it seems that he is getting some attention.

http://www.hanselman.com/blog/ELMAHErrorLoggingModulesAndHandlersForASPNETAndMVCToo.aspx

ELMAH - , :

  • .
  • - .
  • - .
  • , ASP.NET , customErrors.
  • .
  • RSS- 15 .
  • , , Microsoft SQL Server , .
+2

, .pdb . pdb , , .

+1

All of our release code contains stack traces. The only thing we are missing is the line numbers, since they come from .pdb. Do you use an obfuscator?

0
source

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


All Articles