在 Azure 函数中禁用主机锁租约更新调用的日志记录

Disable logging of host lock lease renew calls in Azure Function

我的 Azure Function 每隔 5 秒记录一次对 Azure blob 存储的 http 请求和更新主机锁租约的响应。 “host.json”文件的日志记录部分是否有关闭这些功能的设置?

这些是“信息”级别的消息。我已尝试将“主机”的日志级别设置为“警告”,如下所示:

    {
      "version": "2.0",
      "logging": {
        "logLevel": {
          "default": "Debug",
          "Host": "Warning"
        }
      }
    }

但这似乎不起作用。

以下是您可以遵循的一些解决方法:

您可以尝试将以下命令添加到函数 V2 中的 host.json

{
  "version": "2.0",
  "logging": {
    "logLevel": {
      "Function.MyFunctionName.User": "Information",
      "Function": "Error"
    }
  }
}

同样基于MS DOC

To disable built-in logging, delete the AzureWebJobsDashboard app setting. For information about how to delete app settings in the Azure portal, see the Application settings section of How to manage afunction app.

更多信息请参考:host.json reference for Azure Functions 2.x| MS DOC &