I am studying for the Episerver certification exam and have some questions about logging in DXP.
1. Logging using the log abstraction EPiServer.Logging.LogManager in DXP are automatically sent to Application Insights, the deployment steps in DXP adds this configuration automatic. Am I right? Or do I need to make some configuration to make this work?
2. In the DXP Management Portal (paasportal.episerver.net) I can see the Application Logs. What is the difference between these logs and the logs found in Application Insights, except that the Applicatin Insights give me a lot of tools to view the logs.
Application Insights is an Application Performance Management (APM) service. It is used to monitor your applications, troubleshoot performance issues, etc. Yes, it logs some of the frontend and backend exceptions, but not all of them. If you want to use Application Insights for centralized logging, you're supposed to write your own logging factory that logs to both AI (writes custom events using AI API) and .NET Diagnostics Trace. Also, note that episerver:LoggerFactoryType is set to EPiServer.Logging.TraceLoggerFactory in DXP, so you'll have to contact support to remove that setting from the Azure portal so that you can register your own logger factory in web.config.
Logs that you see in the PaaS portal are the ones that are sent to Trace (generated using episerver logging API).
So you basically need both AI (for performance monitoring/troubleshooting) and PaaS/application logs for error troubleshooting.
Since Application Logs (csv files) are not so user-friendly, episerver partners usually develop their own logger factory that writes logs to both Trace and some 3rd party centralized logging system like ELK/loggly/raygun/seq/you name it.