Reputation: 94
I have a simple Azure function v4, implemented on C#. Have a simple call:
_logger.LogTrace(
new LogTraceParameter
{
Message = "Message to be logged",
FunctionName = context.FunctionName,
SeverityLevel = SeverityLevel.Information,
Category = Category.Request,
SubCategory = SubCategory.Incoming
});
That functionality works fine locally and logs to App Insights. But doesn't work when is deployed to portal. Host.json:
{
"version": "2.0",
"logging": {
"logLevel": {
"default": "Trace"
},
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"excludedTypes": "Request"
}
}
}
As well I checked Instrumetal key. Tried to remove "excludedTypes": "Request", or adding "Function.FunctionName": "Trace" to host.json file. It hasn't helped. Where could be an error?
Upvotes: 0
Views: 648
Reputation: 3196
Can you change "_logger.LogTrace" to "_logger.LogError", to rule out if the issue is related to the severity? For regular asp.net core, only Warning or above is collected by default, not sure if this is affecting you... https://learn.microsoft.com/en-us/azure/azure-monitor/app/asp-net-core?tabs=netcore6#ilogger-logs
Upvotes: 1
Reputation: 11
Have you checked Configuration on azure portal of app insights?
Upvotes: 1