I am using Azure function app v3 and I want to log details into Application Insights.
There is by default ILogger in function app. what is the difference between Ilogger
and TelemetryClient
to log details into App Insights. which is the best way to log details?
Any response is appreciated, Thanks in advance.
There are certain things you cannot do using ILogger
, like tracking multi dimension metrics or events. The Ilogger
lets you only log to the exceptions and traces tables of App Insights. Also, using ILogger
you cannot log extra properties to the custom dimensions field of the telemetry without having them in the message as well using structured logging.
That said, I'd say that for Azure Functions you almost always can do what you want using the ILogger
interface, but it is up to you to decide.