You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Azure Function应用中关闭reactor HTTP日志?

解决Azure Functions中KeyVault SecretClient引发的Reactor线程日志泛滥问题

问题描述

添加KeyVault的SecretClient实例后,出现大量来自Reactor线程的Information级日志,示例如下:

Severity level: Information, Message: 18:40:19.040 [reactor-http-epoll-5]
[INFO ] - : Client is not on azure vm

已尝试在host.json中配置多个reactor相关日志级别为None,但无效。

问题根源

日志中的[reactor-http-epoll-5]是线程名称,而非日志记录器(Logger)的名称。实际输出该日志的是Azure SDK的Azure.Core.Environment日志记录器,之前针对reactor系列的配置无法命中目标。

解决方案

修改host.json的logging.logLevel配置,针对正确的日志记录器设置级别:

"logging": {
    "fileLoggingMode": "debugOnly",
    "logLevel": {
      "default": "None",
      "Host": "Warning",
      "Function": "None",
      "Azure": "Error",
      "Azure.Security.KeyVault.Secrets": "None",
      "Azure.Core.Http": "Error",
      "Azure.Storage.Blob": "Warning",
      // 添加以下配置,屏蔽目标日志
      "Azure.Core.Environment": "None"
    },
    "applicationInsights": {
      "samplingSettings": {
        "isEnabled": true,
        "maxTelemetryItemsPerSecond" : 20,
        "excludedTypes": ""
      }
    }
  }

补充说明

  • 如果仍有其他Reactor线程相关的Azure SDK日志,可以尝试将Azure.Core的级别设为Warning或更高:
    "Azure.Core": "Warning"
    
  • 修改host.json后需重启Azure Functions实例,配置才会生效。

内容的提问来源于stack exchange,提问作者djangofan

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.22 14:20:02