I have an Azure function that's connected to an App Insights instance. The function app emits log messages which I can see in the log stream in the Azure portal, and as App Insights traces.
I've increased the console log level to Verbose by adding a "tracing"
element to host.json
(https://github.com/Azure/azure-webjobs-sdk-script/wiki/host.json), so Verbose level messages show up in the log stream (in both the function page in the Azure portal, and in Kudu), but I can't get Verbose level traces to appear in App Insights.
Does anyone know how to get App Insights to show Verbose level traces from an Azure Function? Is it even possible? (Info traces and above are showing up just fine in App Insights)
You have a lot of control over your log levels for App Insights in Functions, but you don't use the tracing
element for these. We're working on pulling the docs together in one cohesive location, but here's some links that can help:
logger.categoryLevel
host.json settings: https://github.com/Azure/Azure-Functions/wiki/App-Insights-(Preview)#hostjson-settings
For your specific example, you can open up all the Debug
logs (which matches Verbose
in TraceWriter
) with this in your host.json:
{
"logger": {
"categoryFilter": {
"defaultLevel": "Debug"
}
}
}
If you just want to see the verbose logs coming from your Function itself (i.e. you don't want the host's verbose logs appearing), you can restrict that with this -- which says 'for logs with the "Function" category (which is the category that function logs use), show me everything with Debug or higher log level':
{
"logger": {
"categoryFilter": {
"categoryLevels": {
"Function": "Debug"
}
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With