Inconsistent Logs Between Kudu Log Stream and App Insights

Camryn Friedman 0 Reputation points
2025-12-03T22:21:27.23+00:00

I have an Azure Function App written in Java that I am trying to view logs for. For the past few months, I have had a hard time using the native "Log Stream" from Azure Portal, so my go-to log stream is by navigating to "Advanced Tools" (Kudu) and opening Log Stream from there. When I do that, I am able to see many Function App logs appear, as expected.

On the other hand, I also have App Insights configured for my app, with sampling disabled. In host.json I have set most of the log levels to Error in my host.json, but I have included an override in appsettings.json for one of them:

  {
    "name": "APPLICATIONINSIGHTS_ENABLE_AGENT",
    "value": "true",
    "slotSetting": false
  },
  {
    "name": "APPLICATIONINSIGHTS_INSTRUMENTATION_LOGGING_LEVEL",
    "value": "INFO",
    "slotSetting": false
  },
  {
    "name": "AzureFunctionsJobHost__logging__LogLevel__Function",
    "value": "Information",
    "slotSetting": false
  },

As my function is written, it is an Event Hub trigger that simply prints out the received event in the form of a log via the ExecutionContext logger, and does no further processing. There is 1 line of code that logs the event and that is it. I can see all of these event logs in the Log Stream, as mentioned before. However, not all of them are showing up in App Insights.

I have spent time with GitHub Copilot having it analyze my source code along with appsettings.json and host.json files, and I am completely stuck. This log prints out sometimes in App Insights, but other times it does not. Does anyone have any suggestions?

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
{count} votes

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.