Search code examples
.netazureloggingazure-functionsazure-application-insights

Does Azure Function log-level in host.json overwrite appsettings-file loglevel and Application insight loglevel?


log level can be configured in host.json file:

In my app in addition to host.json i have appsettings for dev/test/prod. The appsettingsfiles does not specify anything about loglevel, and nothing about application insight loglevel.

Does host.json impose its configured log-level to all environments, including application insight loggin?


Solution

  • Does host.json impose its configured log-level to all environments, including application insight loggin?

    • Yes, host.json configures application insights and logs function app logs to application insights.

    • In Host.json we will set the logging configurations which are used after deploying the function app.

    Example:

        "logging": {
            "applicationInsights": {
              "samplingSettings": {
                "isEnabled": true,
                "excludedTypes": "Request"     
              }
            }
            }
    

    enter image description here

    • local.settings.json contains AzureWebJobsStorage, FUNCTIONS_WORKER_RUNTIME,APPINSIGHTS_INSTRUMENTATIONKEY

    Example:

    {
        "IsEncrypted": false,
      "Values": {
        "AzureWebJobsStorage": "UseDevelopmentStorage=true",
        "FUNCTIONS_WORKER_RUNTIME": "dotnet",
        "APPINSIGHTS_INSTRUMENTATIONKEY": "27ef877b-5298-4cd9-8a45-a6b99bcc395d"
      }
    } 
    

    enter image description here

    References taken from: