What's the correct way to have webapp logs in Azure?

Viewed 966

We are developing an application based on Azure webapps and are having troubles understanding how to get basic logs from them. There seems to be at least 3 different ways to get some logs:

  • I can access Kudu (?) logs using URL https://my-webapp.scm.azurewebsites.net/
  • I should be able to access the same (?) logs using az webapp log but when I use show command it says no logs are activated
  • I can also access some logs using the Diagnose and Solve Problems menu in the Azure UI but that's cumbersome

What I would like is very simply to be able to do a tail on logs on a running webapp and get all logs that are generated by it, whether it be HTTP request logs from the hosting HTTP server, system logs or applicative level logs.

Can someone point me at the right documents explaining what's the correct way to do that?

1 Answers

To diagnose issues is to look at trace files. Kudu service as well as its application write traces to the /Logfiles folder. You may refer to below link on this:

https://github.com/projectkudu/kudu/wiki/Diagnostic-Log-Stream

https://github.com/projectkudu/kudu/wiki/Kudu-console

Also, you need turn on the diagnostics logs from the Azure Portal or from Azure PowerShell (using the Set-AzureWebsite cmdlet). enter image description here

If using Azure CLI to filter specific log types, such as HTTP, use the --Path parameter.

az webapp log tail --name appname --resource-group myResourceGroup --path http

Reference: Enable diagnostics logging for apps in Azure App Service

Related