如何在 Azure Application Insights 中使用 BeginScope(https://portal.azure.com)?
How to use BeginScope in Azure Application Insights (in https://portal.azure.com)?
我的 C# 代码是 log.BeginScope("Testing Scope1");
和 log.BeginScope("Testing Scope2");
。我如何在 Azure Application Insights 中使用(https://portal.azure.com)?
如果您的代码如下:
using (_logger.BeginScope("Testing Scope1"))
{
_logger.LogInformation("this is an info from index page 111111");
}
然后,在代码执行后,导航至 azure portal -> your application insights -> Logs -> 在 traces
table 中,写入以下查询(还要注意 select一个适当的“时间范围”):
traces
| where customDimensions.Scope contains "Testing Scope1"
| project message, customDimensions
截图如下:
顺便说一句,生成日志可能需要几分钟时间。并且还请在您的应用程序中设置正确的日志级别(如 set the proper log level in your azure function)。
我的 C# 代码是 log.BeginScope("Testing Scope1");
和 log.BeginScope("Testing Scope2");
。我如何在 Azure Application Insights 中使用(https://portal.azure.com)?
如果您的代码如下:
using (_logger.BeginScope("Testing Scope1"))
{
_logger.LogInformation("this is an info from index page 111111");
}
然后,在代码执行后,导航至 azure portal -> your application insights -> Logs -> 在 traces
table 中,写入以下查询(还要注意 select一个适当的“时间范围”):
traces
| where customDimensions.Scope contains "Testing Scope1"
| project message, customDimensions
截图如下:
顺便说一句,生成日志可能需要几分钟时间。并且还请在您的应用程序中设置正确的日志级别(如 set the proper log level in your azure function)。