Troubleshooting application problems are difficult. It takes a lot of time. I would argue that it might be the thing that we developers spend most of our time. When your application is in production, it is even more difficult to find out what went wrong.
Traditionally, you could RDP into the server and open up the app logs, IIS logs or look at the event logs to get a hint of what went wrong. But where can you find that information if you are running your app in the cloud? Things are different in the cloud – there may not be a server to log into.
I recommend read more details on Azure log types and how to activate and use them effectively at https://stackify.com/azure-app-service-log-files/
Log files are useful and even when you are running in Azure, you have plenty of options to get information from log files.
It is difficult to get information from log files as you need to aggregate them and somehow analyze them. These are difficult problems that will slow you down when you are bug-hunting an issue in production.
I recommend using tools that visualise the information that is contained in your Azure logs. You do not have to enable the logs for this specifically as most of these tools capture this information automatically. Tools like “Application Insights” enable you to get an overview of the health of all your applications, including information that is contained in the log files and more. Using tools like these also enable you to be notified of exceptions so that you can go bug-hunting proactively.
Application Insights is an extensible Application Performance Management (APM) service for web developers on multiple platforms. Use it to monitor your live web application. It will automatically detect performance anomalies. It includes powerful analytics tools to help you diagnose issues and to understand what users actually do with your app. It’s designed to help you continuously improve performance and usability.
What you can do with Application Insights?
- You can find and diagnose run-time exceptions
- You can find and diagnose performance issues
- You can monitor and alert on application health
16 Things Every Developer Needs to Know About Application Insights
Application Insights is Microsoft’s lightweight application performance monitoring service. I have collected a nice list of things that every developer should know, including tips, key features, and limitations.
Structured logs with Serilog using Application Insights
Serilog is library to gather structured logs from our application. We can log both exceptions and other events that happened somewhere. I really like it because it’s simple and I can easily serialize and include some objects (ie. method arguments) into logs and easily browse and query them.
I hope this will help !!!