Logging
There are a selection of different diagnostics to assist with debugging an App Service app. The following table shows types, support, storage location and a description:
| Type | Platform | Location | Description |
|---|---|---|---|
| Application logging | Windows, Linux | File system Blob storage |
Logs generated by your application (Critical, Error, Warning, Information, Debug, Trace). |
| Deployment logging | Windows, Linux | File system | Deployment logs for debugging failed deployments. |
| Web server logging | Windows | File system Blob storage |
Raw HTTP request data. |
| Detailed error messages | Windows | File system | Copies of the HTML debug pages that are displayed outside of production. |
| Failed request tracing | Windows | File system | Trace of failed requests, IIS components used, duration in each component, each failed request generates a separate XML/XSL report. |
Configuration
Instructions for enabling optional logging.
Application
- Windows
App Service logsApplication Logging (Filesystem)or(Blob)set toOnFilesystemis for short term logging (turned off after 12 hours)Blobis for long-term logging and requires an Azure storage account
- Set the log level (
Disabled,Error,Warning,Information,Verbose) Save
- Linux/container
App Service logsQuota (MB)- set disk quota for logsRetention Period (Days- set number of days retentionSave
Web server
Only available on Windows
App Service logsWeb server loggingStoragefor blob storage (set storage container andRetention Period (Days))File Systemfor file system (setQuota (MB)andRetention Period (Days))
Save
Streaming
- Azure portal
Log stream
CLI/Cloud Shellaz webapp log tail --name appname --resource-group myResourceGroup
Usage
You can log to application logs using System.Diagnostics.Trace:
System.Diagnostics.Trace.TraceError("If you're seeing this, something bad happened");
Access
You can access your stored logs in different ways depending on the storage method:
FilesystemLinux:https://<app-name>.scm.azurewebsites.net/api/logs/docker/zipWindows:https://<app-name>.scm.azurewebsites.net/api/dump
Blob- Use a client tool that works with Azure storage
Linux/container logs
The zip file at the address above contains both docker host and container logs. For scaled-out apps, the ZIP container logs for each instance individually.