Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure NodeJS console log

I have a Visual Studio Enterprise MSDN subscription so I decided to move from Heroku to Microsoft Azure because I used to pay: now I don't. My Service Plan is the D1. I wish I can trail the console.log strings of my Node JS application deployed on my Azure platform. My service plan is the shared one named I deployed the app code on BitBucket and linked my repo to the application with a correct destribution. Correct means I see the green check flag. I deployed, on the main folder of the app, a file named IISNode.yml, here is the content:

nodeProcessCommandLine: "D:\Program Files (x86)\nodejs\0.12.6\node.exe"
loggingEnabled: true
debuggingEnabled: false
devErrorsEnabled: false
node_env: production

The firse line I copied from the iisnode.yml created by Azure itselves. The other lines I am not quite sure about the exact meanings of all of them, but I figured they were enough. If I visit the url: http://MY_APP_NAME.scm.azurewebsites.net/DebugConsole I can click on Tools->Log Stream menu but the page remains on loading. I can reach the Azure Portal, enter my node app, Tools -> Application Log and Web Server log. The application log shows this (I think quite interesting) message:

System.ApplicationException: The trace listener AzureBlobTraceListener is disabled. ---> System.InvalidOperationException: The SAS URL for the cloud storage account is not specified. Use the environment variable 'DIAGNOSTICS_AZUREBLOBCONTAINERSASURL' to define it.
   at Microsoft.WindowsAzure.WebSites.Diagnostics.AzureBlobTraceListener.RefreshConfig()

I have not reached informations about this "environment variable", and I can0t guess what the BLOB container has to do with my log application. And: what is the correct value for this variable? And if there is any, why is that one correct?

The Web Servier log is are empty. I can see http activities from the monitor of the app on the same portal, but still no log.

Am I missing something ? I decided to install Visual Studio, maybe this will help? I hope this has tools to be integrated with Azure for good. Meanwhile, where is the console log of my (Extremely Simple) node application?

like image 636
Francesco Avatar asked Dec 18 '22 20:12

Francesco


1 Answers

You can view your logs in real time if you use the azure SCM interface. This can usually be accessed on the following url

https://{{ name of webapp }}.scm.azurewebsites.net/api/logstream

All your console output from your application is redirected here.

You can also use curl:

curl -u {{ deploymentCredentialsUsername:deploymentCredentialsPassword }} https://webapp-name.acm.azurewebsites.net/api/logstream

Otherwise you could use the nodejs azure cli. Install it with

npm install -g azure-cli

Switch to asm mode:

azure config mode asm

Then you can proceed to look at the logs from your terminal:

azure site log tail {{ webapp name }}
like image 78
tensai Avatar answered Jan 03 '23 12:01

tensai