[英]How to use BeginScope in Azure Application Insights (in https://portal.azure.com)?
My C# code is log.BeginScope("Testing Scope1");
我的 C# 代码是
log.BeginScope("Testing Scope1");
and log.BeginScope("Testing Scope2");
和
log.BeginScope("Testing Scope2");
. . How can I use in Azure Application Insights (in https://portal.azure.com )?
我如何在 Azure Application Insights 中使用(在https://portal.azure.Z4D5Z56D9A2DDABEC )中
If your code like below:如果您的代码如下所示:
using (_logger.BeginScope("Testing Scope1"))
{
_logger.LogInformation("this is an info from index page 111111");
}
Then, after the code is executed, nav to azure portal -> your application insights -> Logs -> in the traces
table, write the following query(also note that select a proper "time range"):然后,在执行代码后,导航到 azure 门户 -> 您的应用程序洞察 -> 日志 -> 在
traces
表中,编写以下查询(还要注意 select 是一个适当的“时间范围”):
traces
| where customDimensions.Scope contains "Testing Scope1"
| project message, customDimensions
The screenshot is as below:截图如下:
By the way, it may take a few minutes for the logs being generated.顺便说一句,生成日志可能需要几分钟。 And please also set the proper log level in your application(like set the proper log level in your azure function ).
并且请在您的应用程序中设置正确的日志级别(例如在 azure function 中设置正确的日志级别)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.