Question

Difficulty: EasyDiagnose and Log App Service Web Apps

A team is troubleshooting an Azure App Service web application named myApp. They want to configure the application to write diagnostic trace messages to the local filesystem and view the incoming log messages live in their terminal.

Which two Azure CLI commands should they run?

  1. az webapp log config --name myApp --resource-group myRG --application-logging trueAnswer
  2. az webapp log tail --name myApp --resource-group myRGAnswer
  3. C
    az monitor app-insights query --apps myApp --analytics-query "traces"
  4. D
    az keyvault secret show --name AppInsightsKey --vault-name myVault

Answer

The commands to enable application logging to the filesystem and start streaming the logs are: `az webapp log config --name myApp --resource-group myRG --application-logging true` and `az webapp log tail --name myApp --resource-group myRG`.
To view live diagnostic trace messages on the local filesystem of an App Service, you must first enable filesystem-based application logging using the config command, and then initiate the log stream using the tail command.

Step-by-Step Solution

1
Enable application logging to the filesystem for the App Service web application.
FileSystem application logging is activated, allowing runtime trace messages to be captured.
By default, application logging to the filesystem is disabled. It must be turned on using the `az webapp log config` command with the `--application-logging true` parameter.
2
Initiate the live log stream in the terminal.
The terminal starts displaying live trace messages from the application.
Using the `az webapp log tail` command connects to the App Service log streaming service to show output in real time.

Key Concept

Built-in diagnostic logging and log streaming in Azure App Service via Azure CLI
Estimated Time:1m 0s
Rate this question