Azure function apps logs not showing
The log window is a bit fragile and doesn't always show the logs. However, logs are also written to the log files.
You can access these logs from the Kudu console: https://[your-function-app].scm.azurewebsites.net/
From the menu, select Debug console > CMD
On the list of files, go into LogFiles > Application > Functions > Function > [Name of your function]
There you will see a list of log files.
Following the advice here worked for me. Configuring Log Level for Azure Functions
If you want to see your logs show up immediately in the Portal console after you press "Run", then go to your "Function app settings" and add the following to your host.json file:
"logging": {
"fileLoggingMode": "always",
"logLevel": {
"default": "Information",
"Host.Results": "Error",
"Function": "Trace",
"Host.Aggregator": "Trace"
}
}
Note that this only worked for Javascript functions. For locally developed functions in other languages, the console can be a bit skittish.
Microsoft keep changing the interface so many of these answers no longer are correct.
The best way I have found to view the logs is to go into Application Insights for the function itself and then search for some text that might be in the log in Transaction search.
Azure Portal was updated last week and they moved logs from Monitor to the home of the actual Azure Function. However, to see them you need to click Test. I raised an issue with Microsoft support and they spent several days twiddling their thumbs before I came across the answer myself. I hope this saves others a bit of time