Azure Function 1.x Override Log Level via Application Setting In Portal

Ung Tsu Han 1 Reputation point
2022-04-20T09:08:24.037+00:00

Currently, I still have some existing Azure Function in 1.x version.

I plan to implement CICD to apply different log level for different environment

  • dev, stage: Information
  • prod: Error

For Function App 2.x, I am able to configure app setting in release during devops

  • example: AzureFunctionsJobHost__logging__logLevel__Default: Error

For Function App 1.x, I am not able to find any example resource to achieve similar result.

By referring to structure of host.json in 1.x https://learn.microsoft.com/en-us/azure/azure-functions/functions-host-json-v1?tabs=2x-durable-functions#sample-hostjson-file
I follow the structure of key value pair. AzureFunctionsJobHost__logger__categoryFilter__defaultLevel
But that is not working.

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,637 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. MughundhanRaveendran-MSFT 12,451 Reputation points
    2022-04-20T13:35:37.12+00:00

    @Ung Tsu Han ,

    Thanks for reaching out to Q&A.

    There are lots of changes between V2+ and V1 of function app. I would suggest you to make changes to the host.json rather than changing the app settings. You can change the values (as per your requirement) of the logger in the host.json as specified below.

    "logger": {
    "categoryFilter": {
    "defaultLevel": "Information",
    "categoryLevels": {
    "Host": "Error",
    "Function": "Error",
    "Host.Aggregator": "Information"
    }
    }
    },

    Please look at this article for supported values : https://learn.microsoft.com/en-us/azure/azure-functions/functions-host-json-v1?tabs=2x-durable-functions#logger

    Feel free to reach out to me if you have any queries or concerns.