我在 Azure Function Monitor 日志屏幕中看到条目。如何在 Application Insights 中找到它们?
i see entries in then Azure Function Monitor Logs screen. How do I find them in the Application Insights?
我通过单击 Functions/FunctionName/Monitor/Logs
打开我的 Azure 函数的监视器。它显示“正在连接到 Application Insights...”,然后是“已连接”。我 运行 函数和监视器屏幕显示由 _logger.LogInformation()
调用生成的条目。
然后我尝试在 Application Insight 中找到这些条目(特别是第 3 行 Started orchestration
),但我似乎找不到。
我也试过查询,也没有。
我在这里错过了什么?
P.S。将 .NET Core 3.1 与 Microsoft.NET.Sdk.Functions 3.0.9.
一起使用
P.P.S。解决方案是将 "logLevel": {"default": "Information"}
添加到 host.json,如下所示:
{
"version": "2.0",
"logging": {
"applicationInsights": {
"samplingExcludedTypes": "Request",
"samplingSettings": {
"isEnabled": true
}
},
"logLevel": {"default": "Information"}
}
}
根据the official doc -> logging,您应该像下面这样指定日志级别:
"logLevel": {"default": "your_log_level"}
而如果要记录information
级别的消息(所有日志级别请参考Log levels),则应指定为Information
:
"logLevel": {"default": "Information"}
我通过单击 Functions/FunctionName/Monitor/Logs
打开我的 Azure 函数的监视器。它显示“正在连接到 Application Insights...”,然后是“已连接”。我 运行 函数和监视器屏幕显示由 _logger.LogInformation()
调用生成的条目。
然后我尝试在 Application Insight 中找到这些条目(特别是第 3 行 Started orchestration
),但我似乎找不到。
我也试过查询,也没有。
我在这里错过了什么?
P.S。将 .NET Core 3.1 与 Microsoft.NET.Sdk.Functions 3.0.9.
一起使用P.P.S。解决方案是将 "logLevel": {"default": "Information"}
添加到 host.json,如下所示:
{
"version": "2.0",
"logging": {
"applicationInsights": {
"samplingExcludedTypes": "Request",
"samplingSettings": {
"isEnabled": true
}
},
"logLevel": {"default": "Information"}
}
}
根据the official doc -> logging,您应该像下面这样指定日志级别:
"logLevel": {"default": "your_log_level"}
而如果要记录information
级别的消息(所有日志级别请参考Log levels),则应指定为Information
:
"logLevel": {"default": "Information"}