Tessaract
Tessaract

Reputation: 2025

What would be the best-practice for Azure Functions custom logging?

I have an Azure Function and I want to log custom messages, like log("16% completed");.

I tried it with application insights but couldn't find how to create a separate category for my custom logs, so I would be able to filter them, drill down into them for diagnostics and debug and etc.

From what I've read, there's also Log Analytics, but it seems now that and Application Insights are combined.

So, if I wanted my Azure Function to log custom messages, that I would use to monitor execution, be able to use them for debugging/troubleshooting and statistics, what would be the best-practice?

Upvotes: 1

Views: 2088

Answers (1)

Thiago Custodio
Thiago Custodio

Reputation: 18362

You're correct. The best practice is using Application Insights / Log Analytics. You can either set them as custom properties or using another dimension such as customEvents or dependency.

https://learn.microsoft.com/en-us/azure/azure-monitor/app/api-custom-events-metrics#custom-events-in-analytics

Upvotes: 3

Related Questions