22

I deployed a nodejs web app on azure as an App Service

How do i see the console.log from my application?

developer7788
  • 389
  • 1
  • 2
  • 15
  • I suggest you could refer to this [article](https://stackoverflow.com/questions/34842355/azure-nodejs-console-log) and this [article](https://social.msdn.microsoft.com/Forums/en-US/6b6deab8-a147-48ca-80d7-03b2ca377a98/how-do-i-see-consolelog-output-from-nodejs-on-azure-website?forum=windowsazurewebsitespreview), there are some ways to see the logs. – Janley Zhang Apr 11 '18 at 06:12
  • Have you solved this issue, do you need further assistance? – Bruce Chen Apr 13 '18 at 02:07

3 Answers3

15

You can tail the log with the Azure CLI...

$ az webapp log tail --name <name of webapp> --resource-group <name of resource group>

More info here

mackysassr
  • 171
  • 1
  • 4
11

I just followed Enable diagnostics logging to enable Application Logging (Filesystem), Application Logging (Blob) and found console.log and console.error would output logs under D:\home\LogFiles\Application\, you could use KUDU to view your log files or you could also access https://{your-app-name}.scm.azurewebsites.net/api/vfs/LogFiles/Application/index.html and check the stdout and stderr type as follows:

enter image description here

Moreover, as Azure Web App (Website) Logging - Tips and Tools mentioned about application logs for node.js as follows:

Setting application logs in the Azure portal

For node.js websites the way to write application logs is by writing to the console using console.log('message') and console.error('message') which goes to Information/Error level log entries. Currently the only supported target for the log files for node.js is the file system.

Other web site types like php and python are not supported for the application logs feature.

For logging into blob, you may leverage winston-azure-blob-transport for collecting the application logs from your Node.js web app into Azure Blob Storage.

Community
  • 1
  • 1
Bruce Chen
  • 18,207
  • 2
  • 21
  • 35
7

You can open a Log Stream using the azure portal.

enter image description here

Marcello B.
  • 4,177
  • 11
  • 45
  • 65
user890332
  • 1,315
  • 15
  • 15