简体   繁体   English

Azure Functions :如何使用本地调试模式将日志写入 Azure Application Insights 和 Azure Functions 使用 Python?

[英]Azure Function : How do I write my logs to Azure Application Insights using local debug mode with Azure Functions using Python?

I want to write my logs to the Azure Application Insights but I do not know how to achieve it.我想将我的日志写入 Azure Application Insights,但我不知道如何实现。
Do I need to update my azure function local.settings.json and host.json file ??我需要更新我的 azure 函数local.settings.jsonhost.json文件吗??
Also, do I need to use call specific function in init .py file to write my logs to Azure Application Insights?另外,我是否需要使用init .py文件中的调用特定函数将我的日志写入 Azure Application Insights?
Can you please share some examples to write logs.你能分享一些写日志的例子吗? Please note- I am using python for my Azure function.请注意 - 我在 Azure 函数中使用 python。
Thanks谢谢

This is the host.json:这是host.json:

{
    "version": "2.0",
    "logging": {
        "applicationInsights": {
            "samplingSettings": {
                "isEnabled": true,
                "excludedTypes": "Request"
            }
        }
    }
}

This is the official settings:这是官方设置:

https://docs.microsoft.com/en-us/azure/azure-functions/functions-host-json#applicationinsights https://docs.microsoft.com/en-us/azure/azure-functions/functions-host-json#applicationinsights

'applicationInsights.samplingSettings.isEnabled' is to Enables or disables sampling. 'applicationInsights.samplingSettings.isEnabled'是启用或禁用采样。

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

相关问题 Azure python 的函数,结构化日志记录到 Application Insights? - Azure Functions for python, structured logging to Application Insights? 如何使用python sdk访问在Azure Application Insights中记录的数据? - How can I access the data that is getting logged in Azure Application Insights using python sdk? How can I get JSON data into Azure Time Series Insights through an Azure EventHub using Python? - How can I get JSON data into Azure Time Series Insights through an Azure EventHub using Python? Python 记录器异常在 Azure Application Insights (Azure Function) 中记录为跟踪 - Python Logger exception is logged as trace in Azure Application Insights (Azure Function) 在Azure函数中使用Python 3 - Using Python 3 in Azure Functions 如何使用python从Azure函数将消息发送到Azure中的队列? - How to do I send a message to a queue in Azure from an Azure function using python? 使用 python 的 Azure 函数是否支持函数过滤器? - Is Function Filters supported for Azure functions using python? 语言工作者如何使用 Python 在 Azure 函数中工作? - How do language workers work in Azure Functions using Python? 执行Python Azure函数时未显示记录DEBUG日志 - Logging DEBUG logs are not shown when executing the Python Azure Functions 如何使用带有 python 的 Azure 函数写入 blob 容器中的文本文件? - How to write to a text file in a blob container using Azure function with python?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM