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

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

问题描述

是否可以在不更新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实例.主机配置不是env变量.

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功能的日志级别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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