ASP.NET - collection or registration of errors

We are creating an ASP.NET application in C #

We have 3 levels: user interface, business and database. We need to clarify error handling / logging. We have an error logging mechanism for error logging.

My question is: do I need to register errors on each layer or only at the main call level (user interface layer), choosing errors at the user interface level from the business and database layers? Is there any best practice?

If it would be great, if you could also provide a background document or web links (if necessary).

Thanks and Regards ... Sruthi Keerthi.

+2
source share
5 answers
  • Handle any exceptions you may have in the layer that they have. Let those that you cannot process with bubbles to the level of the user interface. See Exception Handling Guidelines for ASP.NET Web Applications for more information.
  • Use an exception logging mechanism, such as Elmah , to log exceptions in the user interface.
+3
source

- Exception , , , , . , SqlExceptions , . , , , Exceptions .

- - . , - , , / , - (.. Exception).

( ) . ?

+2

ASP.net. log4net ( log4j). DLL , , .

. , . , , .

+1

. HttpApplication.Error. , (.. DB, ​​, ... ..).

+1

:

  • A log error where this occurs is what MUST.
  • Display in the user interface, depending on your choice, you can either display a complete error message plus a stack trace, or simply display a configured friendly error message that provides sufficient information to find the error logged in step 1.
0
source

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


All Articles