skip to Main Content

I have an Azure Function written in Java that is accompanied with following host.json file:

{
    "version": "2.0",
    "extensionBundle": {
        "id": "Microsoft.Azure.Functions.ExtensionBundle",
        "version": "[3.*, 4.0.0)"
    },
    "extensions": {
        "http": {
            "routePrefix": ""
        },
        "queues": {
            "maxPollingInterval": "00:00:10"
        }
    },
    "logging": {
        "logLevel": {
            "default": "Warning",
            "Host": "Warning",
            "Function": "Warning",
            "Azure.Core": "Error"
        }
    }
}

In my understanding setting the "default": "Warning" log level should result in producing very little logs, except for situations when something unusual happens. Unfortunately this does not seem to be the case. In Application Insights I can see tons of log entries like for example:

  • "WorkerStatusRequest completed"
  • "Worker initialized"
  • "Worker terminate request received. Gracefully shutting down the worker."
  • "Function "abc" (Id: defghijk) invoked by Java Worker"
  • "Executed ‘Functions.abc’ (Succeeded, Id=defghijk, Duration=826ms)"
  • "FunctionLoadRequest received by the Java worker, Java version – C:Program FilesJavamicrosoft-jdk-11.0.16.1 – 11.0.16.1"

My question is how to make it silent. Those log statements are not so interesting for me. I have also observed that they are all logged with SeverityLevel=1 which according to the docs is equal to Debug.

Thanks for any help.

2

Answers


  1. Try making all possible options to false under Application insights

    {
    "version": "2.0",
    
    "logging":{ "logLevel":"default":"Information",
    

    "Function": "Information", "Host.Aggregator":"Information",
    "Host": "Error" },
    "applicationInsights":
    {
    "enableDependency Tracking": false,
    "excludedTypes": "Request; Dependency:"

    } } }}
    
    Login or Signup to reply.
  2. Modify your host.json as shown below to reduce the excessive logging:

    {
      "version": "2.0",
      "extensionBundle": {
          "id": "Microsoft.Azure.Functions.ExtensionBundle",
          "version": "[3.*, 4.0.0)"
      },
      "extensions": {
          "http": {
              "routePrefix": ""
          },
          "queues": {
              "maxPollingInterval": "00:00:10"
          }
      },
        "logging": {
          "logLevel": {
            "default": "Warning",
            "Function": "Error",
            "Host.Aggregator": "Error",
            "Host.Results": "Information",
            "Function.Function1": "Information",
            "Function.Function1.User": "Error"
          },
          "applicationInsights": {
            "samplingSettings": {
              "isEnabled": true,
              "maxTelemetryItemsPerSecond": 1,
              "excludedTypes": "Exception"
            }
          }
      }
    }
    

    You can aso change all the log levels to Warning or Error.

    Response:

    enter image description here

    enter image description here

    As per doc, when the SeverityLevel=1, it refers to Information. So it displays all the function related information.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search