6

I have an environment running Sitecore 9.2 on Azure PAAS. It's an upgraded codebase (from 9.0.2) but on a clean setup.

I had an issue with logging. Application Insights is working fine - I can see my logs there. But I also liked to use the log stream in the Azure portal when I had to debug something. On our 9.0.2 environment this was working, but on the 9.2 it was not.

I noticed there are some changes in the Application Insights setup on 9.2, but I can't seem to find good documentation on how to configure this (and I am no Azure expert). I got some ideas on Slack:

  • set ApplicationInsights.DeveloperMode to true
  • disable Application Insights

I tried the DeveloperMode but that didn't help.

In the app settings on 9.2 there is also a key useApplicationInsights:define. When I turn this to false, the log stream starts working. But this disables AI.

What is this useApplicationInsights:define key? How does it work and how should I configure this on Sitecore 9.2 to get AI and the log stream working?

  • That looks to be one of the custom definitions that can be used to enable/disable config sections in patch configs (like role:define for ContentManagment or ContentDelivery, or search:define for Azure or Solr). I would suggest searching the configs for useApplicationInsights:require to see what turns up... – Dan Sinclair Oct 14 at 18:06
  • Indeed it is. I did search and found references to it. But it didn't make a lot of sense. So I was looking for someone with deeper knowledge of App Insights & Azure logging to explain how I should configure this in 9.2 - knowing that I would like to have AI and log stream. – Gatogordo Oct 14 at 18:48
  • I don't think the Log Stream and App Insights in Sitecore are really related. Log Stream is IIS's log, not Sitecore's. In order for the Log Stream to work you have to enable the features. The lag seems less if you use the File System rather than Blob storage. (Yes, I know the File System is Blob storage, but you try it). The "Stream" is basically just tailing the files as they are written, but as with IIS they are written in chunks, not one line at a time so responsiveness mileage varies. – Richard Hauer Oct 15 at 0:43
  • 1
    FWIW, I normally turn off App Insights for logging. It's $3 per GB and the default daily limit is 100 GB - customers don't like getting a nasty $3000 bill when the Marketing Automation engine logs 40,000,000 exceptions per day because an SSL cert has expired somewhere. If you must use it, set the daily cap to 3GB or less – Richard Hauer Oct 15 at 0:45
0

Log Stream reads from the trace on the local disk. In order to get the Sitecore log to log streams, you need two configurations in place: A log4net traceappender and application logging enabled.

The AI log4net appender in 9.0.x was actually just logging to trace. It seems they've updated it to log to AI directly (which is more right if they have but I haven't verified it)

So:

  1. Ensure there's a log4net traceappender attached to your sitecore log4net root such as https://logging.apache.org/log4net/release/sdk/html/T_log4net_Appender_TraceAppender.htm

  2. Ensure log to disk is enabled in the App Service itself: => App Service Logs => Application Logging (File System) => On

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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