覆盖 Azure Functions 的日志级别 [英] Overriding Log Level for Azure Functions

查看:23
本文介绍了覆盖 Azure Functions 的日志级别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在不更新 host.json 文件的情况下覆盖 Azure Function 应用的默认日志级别?我希望我的函数仅在开发环境中将跟踪日志传递给应用程序洞察力.我在想是否可以只设置一个环境变量,并且该函数将知道何时传递日志.

Is there a way to override the default log level of an Azure Function app without updating the host.json file? I want my function to pass trace logs to application insights only on dev environment. I'm thinking if an environment variable can just be set and the function will know when to pass the logs.

推荐答案

我们无法使用环境变量配置日志级别.当函数 host 启动时,它从 host.json 中读取日志级别,并注入 ILogger 实例和相应的过滤规则.主机配置不是环境变量.

we can't configure the log level using environment variables. When function host starts, it reads log level from host.json and inject ILogger instance with corresponding filter rules. Host configurations are not env variables.

这篇关于覆盖 Azure Functions 的日志级别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆