How would you design and implement a robust logging and error handling mechanism in an Angular/.NET Core ERP application to facilitate troubleshooting and debugging?
I need to track and monitor application errors and exceptions effectively, ensuring seamless operation and quick resolution of issues in the ERP system.
Loading

Rasul HuseynovPosted May 12, 2024, 9:31 AM
Hi,
For ERP system, you need to consider to centralized logging. Because you need to track exceptions, metrics (like execution time, memory consumption, etc..) and you will get better analytics. Also logging and metrics should be isolated for resiliency. So, I recommend using the ELK stack to meet all this requirements.
Some articles:
https://learn.microsoft.com/en-us/dotnet/architecture/cloud-native/logging-with-elastic-stack
https://hackmd.io/@Entegrasyon/SkwF7tlAp
https://medium.com/@murataslan1/elk-stack-on-net-b30bf885c606
https://bogdanhatis.com/configure-elk-stack-in-net-core-6/
Jaydeep PatilPosted May 11, 2024, 10:47 AM
Hi,
First, in the .NET Core you can use inbuilt logging mechanism else there are few logging libraries like Serilog and NLog which provides robust logging mechanism. Also, in .NET Core we can create our own custom middleware through which we can handle high level errors and generate logs as well.
Second, In Angular you can use HTTP Intercepters to handle errors at global level and log the same with the help of different logging mechanism and inside the each component you can implement try catch block and inside that catch the errors and log as well.
Please check my few below articles for the same.
https://www.c-sharpcorner.com/article/logging-in-net-core-with-serilog/
https://www.c-sharpcorner.com/article/logging-in-net-core-with-nlog/
Thanks
Jaimin ShethiyaPosted May 11, 2024, 10:19 AM
Hello Vikas,
You need to implement the custom middleware for each and every request logged on the NLog, or log4net, or application insights.
Please refer below links.
https://exceptionnotfound.net/middleware-in-asp-net-6-custom-middleware-classes/
https://makolyte.com/aspnetcore-logging-requests-and-responses/
https://blog.elmah.io/asp-net-core-request-logging-middleware/
https://stackoverflow.com/questions/71082172/net-6-custom-middleware-logging-mixing-responses-and-requests
Thanks