You can configure the application logging and set the desired log level using the Azure Command-Line Interface (CLI). Here's how:
az webapp log config \
--name <your-app-name> \
--resource-group <your-resource-group> \
--application-logging filesystem \
--level Information
Replace <your-app-name>
and <your-resource-group>
with your actual App Service name and resource group name. This command enables application logging to the file system and sets the log level to "Information". You can adjust the --level
parameter to Error
, Warning
, Information
, or Verbose
based on your needs. Azure CLI - az webapp log config
Another approach is to configure diagnostic settings to send logs to a destination like Log Analytics, Azure Storage, or Event Hubs:
- Navigate to your App Service in the Azure Portal.
- In the left-hand menu, select Monitoring => Diagnostic settings.
- Click on + Add diagnostic setting.
- Provide a name for the setting.
- Under Logs, select the categories you wish to collect, such as:
- AppServiceAppLogs: Application logs.
- AppServiceHTTPLogs: HTTP request logs.
- Choose your destination(s) for the logs (e.g., Log Analytics workspace).
- Click Save to apply the settings.
- AppServiceAppLogs: Application logs.
This method allows for more granular control over log collection and retention. Enable diagnostics logging for apps in Azure App Service
If you have any further assistant, do let me know.