I deployed a nodejs web app on azure as an App Service
How do i see the console.log from my application?
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.
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.
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.
To stream logs in the Azure portal, navigate to your app and select Log stream.
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
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:
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With