What is the best way to handle Exceptions and Log in WebAPI (C #)? [duplicate]

0

Scenario: WebAPIs in .NET 4.x

Objective: Improve Logging (info, error, debug, warning) and Exception Handling, for example, logging exceptions, which frameworks do Logs use? Where do they usually store Logs? I found a tool called DataDog have you ever seen?

I found these steps here too: link

Edit

My question was marked as duplicate .. however I did not find anything related to the context (EXCEPTION + LOG) .. Log only ... my focus is Exception too.

    
asked by anonymous 14.11.2017 / 16:13

2 answers

1

I think about the location of store, I like tools that store in N locations, the log has to persist you can not get referen from a means of access to it. That's why I use serilog , it persists in several form including bank and files (which are the most used).

I do not know the DataDog, but in general the tools are very similar, try to find one that suits you and that has enough users that is the case of serilog and log4net, thus you guarantee the good maintenance in case of problem in them . The important thing is the good treatment in the code and a good infra for storage.

    
14.11.2017 / 19:31
1

I recommend taking a look at Log4Net which is very popular and you can find interesting content in Portuguese (eg Macoratti ) and in the Elmah which is a very complete and very interesting tool.

    
14.11.2017 / 19:27