Exception Log code
Exception Log code in Asp.net
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Exception Log code
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Vishal YelveRank #178 · 13.6K reputationPosted Oct 5, 2023, 12:15 AM EDT
Hi,
There are several ways to log exception.
https://www.c-sharpcorner.com/UploadFile/0c1bb2/logging-excetion-to-text-file/
https://www.codeproject.com/Articles/5344667/Logging-with-Serilog-in-ASP-NET-Core-Web-API
https://www.c-sharpcorner.com/article/introduction-to-nlog-with-asp-net-core2/
Sachin SinghRank #66 · 26.2K reputationPosted Oct 5, 2023, 2:09 AM EDT
I often use NLog, here is an article on NLog
https://codewithmukesh.com/blog/logging-with-nlog-in-aspnet-core/
Utpal Dutta168 reputationPosted Oct 5, 2023, 2:28 AM EDT
Exception logs can be handled in multiple way.
1. You can follow traditional way using try-catch block
2. You can handle globally using Exception filter
3. You can handle through middleware also