Log files are a great resource for a Web developer, but only if you know how to find and use the logged information. Here, you’ll look at the methods you can use to retrieve logged information, ready for offline analysis.
Log file storage locations
The Azure infrastructure used to run Azure Web Apps in Windows is not the same as that for Linux apps, and log files are not stored in the same locations.
Windows app log files
For Windows apps, file system log files are stored in a virtual drive that is associated with your Web App. This drive is addressable as D:\Home, and includes a LogFiles folder; within this folder are one or more subfolders:
- Application – Contains application-generated messages, if File System application logging has been enabled.
- DetailedErrors – Contains detailed Web server error logs, if Detailed error messages have been enabled.
- http – Contains IIS-level logs, if Web server logging has been enabled.
- W3SVC<number> – Contains details of all failed http requests, if Failed request tracing has been enabled.
Linux app log files
For Linux Web Apps, the Azure tools currently support fewer logging options than for Windows apps. Redirections to STDERR and STDOUT are managed through the underlying Docker container that runs the app, and these messages are stored in Docker log files. To see messages logged by underlying processes, such as Apache, you will need to open an SSH connection to the Docker container.
All Azure Web Apps have an associated Source Control Management (SCM) service site. This site runs the Kudu service, and other Site Extensions; it is Kudu that manages deployment and troubleshooting for Azure Web Apps, including options for viewing and downloading log files. The specific functionality available in KUDU, and how you download logs, depends on the type of Web App. For Windows apps, you can browse to the log file location, and then download the logs; for Linux apps, there may be a download link.
One way to access the KUDU console is navigate to https://<app name>.scm.azurewebsites.net, and then sign in using deployment credentials.
You can also access KUDU from the Azure portal. On the app pane, in the Development Tools section, select Advanced Tools, and then on the Advanced Tools pane, to open a new Kudu Services tab, select Go.
Azure Storage Explorer
To access Windows logs saved to an Azure Blob Storage container, you can use the Azure portal; to view and download the contents of the log file container, select Storage Explorer. Open the relevant year, month, date, and hour folder, then double-click a CSV file to download it to your computer.