I tried to install Application Insights on Sitecore 10.1 project in Azure PaaS. After installing the AI SDK and configuring the instrumentation key the app insights started to pick up Sitecore logs e.g. coming from Sitecore Kernel, but not our custom logs which we would like to log as well. We have not changed any logging configuration so we are using the default Sitecore Diagnostics Log.Error methods for that. The errors are being logged correctly on lower environments however in Azure this does not work at all. I checked the daily cup and we did not exceed it yet so it should be working.

Could you please advise what to check or if there is any additional configuration required to make it work in AI?

  • Are diagnostic traces being collected from all app services or at least the ones that you expect to receive custom logs? I suggest to run a query in your App Insights instance to check, like this one: traces | summarize count() by cloud_RoleInstance. You could also aggregate by cloud_RoleName , but its value is not always populated for all app services. Commented Sep 29, 2021 at 14:50
  • No, there are no traces collected at all unfortunately @AlessandroFaniuolo
    – 9_9
    Commented Sep 30, 2021 at 6:55
  • Are other events being collected in App Insights? Do you see requests being collected? Try for example to run the following query to check: requests | summarize count() by cloud_RoleInstance. Also do you see any instance in the "Application map" section? Commented Sep 30, 2021 at 13:08

1 Answer 1


When Sitecore is deployed to Azure PaaS, XM and XP packages for app services contain additional config files for Application Insights in the folder \App_Config\Sitecore\Azure. The file \App_Config\Sitecore\Azure\Sitecore.Cloud.ApplicationInsights.config replaces default log file appenders with Application Insights appenders for standard Sitecore log files.

Ensure that your custom logs switch to the Application Insights appender in Azure environments too. They should have configuration similar to standard Sitecore logs:

  <appender name="YourCustomLogFileAppender" type="log4net.Appender.SitecoreLogFileAppender, Sitecore.Logging"></appender>
  <appender name="YourCustomLogFileAppender" patch:instead="appender[@name='YourCustomLogFileAppender' and @type='log4net.Appender.SitecoreLogFileAppender, Sitecore.Logging']">
    <patch:attribute useApplicationInsights:require="false" name="type">Sitecore.Cloud.ApplicationInsights.Logging.LevelTraceAppender, Sitecore.Cloud.ApplicationInsights</patch:attribute>
    <patch:attribute useApplicationInsights:require="!false" name="type">Sitecore.Cloud.ApplicationInsights.Logging.Log4NetAppender, Sitecore.Cloud.ApplicationInsights</patch:attribute>
    <category useApplicationInsights:require="!false" value="yourCustomLog" />

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.