Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nodejs on Azure where is output of the console log

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

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

like image 834
developer7788 Avatar asked Apr 11 '18 05:04

developer7788


People also ask

Where do Nodejs logs go?

Answer. Note: Node. js can also records logs directly into /var/www/vhosts/system/example.com/logs/ directory, but this functionality is a part of Passenger Enterprise which is not included into the free edition that is provided by Plesk.

How does Nodejs console log work?

log() function from console class of Node. js is used to display the messages on the console. It prints to stdout with newline. Parameter: This function contains multiple parameters which are to be printed.

Can you console log from node modules?

log and console.The built-in console module in Node. js lets you write log messages to standard output (stdout) and standard error (stderr)using the log and error functions, respectively.

How do I check Azure server logs?

To stream logs in the Azure portal, navigate to your app and select Log stream.


2 Answers

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

like image 132
mackysassr Avatar answered Sep 18 '22 12:09

mackysassr


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.

like image 36
Bruce Chen Avatar answered Sep 19 '22 12:09

Bruce Chen