Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Debugging Node.js applications on Azure App Services Linux/containers

This is the continuation of the earlier post where I had explained how to enable logging for node applications on App Service Windows.  In this blog, you will learn how to debug the node.js applications that are hosted on Azure App Service Linux / Azure webapp for containers.

Enabling logs on linux offerings of AppService is fairly easier and pretty straight forward when compared to Windows.

Enable Logging on Linux

  • Navigate to your webapp from the azure portal
  • Choose the Diagnostic Logs blade. Here we have only one option to enable logs which is docker container logs unlike in Windows, where we have the storage option as well. As of today, we do not have the option of storing the logs to blob storage in App Service Linux.
  • Choose File System, specify the retention period of your choice. This will delete the logs that are older than specified number of days

  • This will gather all the STDOUT and STDERR logs of the container into /home/LogFiles folder
  • Once you have configured using above step, you will be able to access these log files by following the steps below
  • Go to your file system by browsing https://{webapp_name}.scm.azurewebsites.net url (called as kudu site)
  • Click on Debug Console –> Bash. If it is app service Linux, you can alternatively choose SSH option
  • Please note that SSH works only for App Service Linux. But for Webapp Containers, you would need to configure it by following the official documentation here
  • Navigate to the LogFiles folder by running the command “cd LogFiles
  • Now run the command “ls -lrt” to list all the log files with the latest one in the bottom. The stderr and stdout logs are stored in the file that ends with default_docker.log as shown below

  • You can view this by running the command cat . If your application has any stdout/stderr configured, it will be seen in this log file.

  • You can also download it using FTP and steps to follow are specified here
  • If you are only looking for the latest docker logs, the quickest way is to go to Kudu console and click on Current Docker Logs option as shown below. However, this will only give the information related to the container, but not the stdout/stderr logs.

  • Once you click on this link, you will be redirected to a new page with all the details related to the latest docker logs

  • Now, copy paste the link that is highlighted into the new tab and you should see the output as below

Share the post

Debugging Node.js applications on Azure App Services Linux/containers

×

Subscribe to Msdn Blogs | Get The Latest Information, Insights, Announcements, And News From Microsoft Experts And Developers In The Msdn Blogs.

Get updates delivered right to your inbox!

Thank you for your subscription

×