POST POST

MAY
8
2021

Logging in Functions

ORIGINALLY POSTED TO: https://blog.simontimms.com/2021/05/08/function-appinsights

Looks like by default functions log at the info level. To change the level you can use set the application setting AzureFunctionsJobHost__logging__LogLevel__Default to some other value like Error or Info.

If you want to disable adaptive sampling then that can be done in the host.json

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{
"version": "2.0",
"extensions": {
"queues": {
"maxPollingInterval": "00:00:05"
}
},
"logging": {
"logLevel": {
"default": "Information"
},
"applicationInsights": {
"samplingSettings": {
"isEnabled": false
}
}
},
"functionTimeout": "00:10:00"
}

In this example adaptive sampling is turned off so you get every log message.

A thing to note is that if you crank down logging to Error you won't see the invocations at all in the portal but they're still running.


Simon Timms

Email Email
Web Web
Twitter Twitter
GitHub GitHub
RSS

Looking for someone else?

You can find the rest of the Western Devs Crew here.

© 2015 Western Devs. All Rights Reserved. Design by Karen Chudobiak, Graphic Designer