简体   繁体   English

在 azure 门户中查找日志库创建的日志

[英]Find the logs created by logging library in azure portal

I built a python function in Azure.我在 Azure 中构建了一个 python 函数。 I used the library logging to record some important steps in my function.我使用库日志记录了我的函数中的一些重要步骤。 I am using the level "info" of this library.我正在使用这个库的级别“信息”。 My question is how do I find the logs created after execution in Azure portal?.我的问题是如何找到在 Azure 门户中执行后创建的日志?。 I would like to see these logs to validate the execution of my function.我想查看这些日志来验证我的函数的执行。

Tks in advance提前谢谢

Update 1:更新1:

I found in the Microsoft documentation:我在 Microsoft 文档中找到:

Logging Access to the Azure Functions runtime logger is available via a root logging handler in your function app.可以通过函数应用中的根日志记录处理程序访问 Azure Functions 运行时记录器。 This logger is tied to Application Insights and allows you to flag warnings and errors that occur during the function execution.此记录器与 Application Insights 相关联,允许您标记函数执行期间发生的警告和错误。

Python developer reference: Logging Python 开发人员参考:日志记录

However, I do not know how to find these logs in Applications Insights.但是,我不知道如何在 Applications Insights 中找到这些日志。

Update 2:更新 2:

My function has already the settings:我的功能已经有设置:

  • APPINSIGHTS_INSTRUMENTATIONKEY APPINSIGHTS_INSTRUMENTATIONKEY
  • APPLICATIONINSIGHTS_CONNECTION_STRING APPLICATIONINSIGHTS_CONNECTION_STRING

When I checked 'Transaction search' in the application insights, I am not getting the logs that I defined in my function using the library 'logging'.当我在应用程序洞察力中检查“事务搜索”时,我没有得到我在函数中使用库“日志记录”定义的日志。 Here an example what I see:这是我看到的一个例子:

在此处输入图像描述

The logs are seemly the standard one that Azure has.日志似乎是 Azure 的标准日志。

Few things -一些事情 -

  • Have you enabled Application Insights?您是否启用了 Application Insights? And setup the the storage account for logs?并设置日志的存储帐户?
  • Can you see Application Insights related configs in your Configuration > Application Settings您能否在“配置”>“应用程序设置”中看到与 Application Insights 相关的配置

在此处输入图像描述

If the above are all fine, without your code snippet its hard to tell if there's something wrong.如果以上都很好,没有你的代码片段很难判断是否有问题。

To see the logs, try navigating to -要查看日志,请尝试导航到 -

  1. Your Azure Function's Application Insights Azure 函数的 Application Insights
  2. Click on 'View Application Insights data'单击“查看 Application Insights 数据”
  3. Then on the left nav bar look for 'Transaction Search' and click it然后在左侧导航栏上查找“交易搜索”并单击它
  4. Finally, click the center button 'See all data in the last 24 hours'最后,单击中心按钮“查看过去 24 小时内的所有数据”

在此处输入图像描述

在此处输入图像描述

Wait for it to load your logs, and hopefully if everything is setup correctly you'll see your logs there.等待它加载您的日志,希望如果一切设置正确,您将在那里看到您的日志。

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM