Functions Verbose Logging

Troubleshooting Functions is easier with good, and verbose logs.

Utilizing the following app settings will present the detailed logs of the Function Host

Below are the App Settings in Raw Format

AzureFunctionsJobHost__logging__fileLoggingMode set to always
AzureFunctionsJobHost__logging__console__isEnabled set to true
AzureFunctionsJobHost__logging__logLevel__default set to Trace
AzureFunctionsJobHost__logging__logLevel__Host.Results set to Trace
AzureFunctionsJobHost__logging__logLevel__Function set to Trace
AzureFunctionsJobHost__logging__logLevel__Host.Aggregator set to Trace
AzureFunctionsJobHost__logging__logLevel__Microsoft

If re-deploying the app is not desired, its possible to add these all in one go via the App Settings by populating this json format of the above app settings into Advanced section of the Azure Portal -> App Service -> Configurations.

,
  {
    "name": "AzureFunctionsJobHost__logging__fileLoggingMode",
    "value": "always",
    "slotSetting": false
  },
  {
    "name": "AzureFunctionsJobHost__logging__console__isEnabled",
    "value": "true",
    "slotSetting": false
  },
  {
    "name": "AzureFunctionsJobHost__logging__logLevel__default",
    "value": "Trace",
    "slotSetting": false
  },
  {
    "name": "AzureFunctionsJobHost__logging__logLevel__Host.Results",
    "value": "Trace",
    "slotSetting": false
  },
  {
    "name": "AzureFunctionsJobHost__logging__logLevel__Function",
    "value": "Trace",
    "slotSetting": false
  },
  {
    "name": "AzureFunctionsJobHost__logging__logLevel__Host.Aggregator",
    "value": "Trace",
    "slotSetting": false
  },
  {
    "name": "AzureFunctionsJobHost__logging__logLevel__Microsoft",
    "value": "Trace",
    "slotSetting": false
  }

Durable Functions Version

,
  {
    "name": "AzureFunctionsJobHost__logging__fileLoggingMode",
    "value": "always",
    "slotSetting": false
  },
  {
    "name": "AzureFunctionsJobHost__logging__console__isEnabled",
    "value": "true",
    "slotSetting": false
  },
  {
    "name": "AzureFunctionsJobHost__logging__logLevel__default",
    "value": "Trace",
    "slotSetting": false
  },
  {
    "name": "AzureFunctionsJobHost__logging__logLevel__Host.Results",
    "value": "Trace",
    "slotSetting": false
  },
  {
    "name": "AzureFunctionsJobHost__logging__logLevel__Function",
    "value": "Trace",
    "slotSetting": false
  },
  {
    "name": "AzureFunctionsJobHost__logging__logLevel__Host.Aggregator",
    "value": "Trace",
    "slotSetting": false
  },
  {
    "name": "AzureFunctionsJobHost__logging__logLevel__Microsoft",
    "value": "Trace",
    "slotSetting": false
  },
  {
    "name": "AzureFunctionsJobHost__logging__logLevel__Host.Triggers.DurableTask",
    "value": "Trace",
    "slotSetting": false
  },
  {
    "name": "AzureFunctionsJobHost__logging__logLevel__DurableTask.AzureStorage",
    "value": "Trace",
    "slotSetting": false
  },
  {
    "name": "AzureFunctionsJobHost__logging__logLevel__DurableTask.Core",
    "value": "Trace",
    "slotSetting": false
  },

What this looks like on the Azure Portal if we were to add the settings manaully:

Once reproducing these logs, we can download the content by browsing to the following site

https://<SITE_NAME>.scm.azurewebsites.net/api/zip/LogFiles/ 

Ensure the / at the end of LogFiles/ is there because this will allow a recursive pull of the log files.

Leave a comment