1
votes

Have enabled Azure application insights. https://docs.microsoft.com/en-us/azure/azure-monitor/app/nodejs

Want to log the output from my express Node JS application:

GET /api/loggedin 304 6.377 ms - -
GET /api/xx 304 31.052 ms - -
hello // a console.log
GET /api/loggedin 304 5.127 ms - 

Where can I see the console.log data? Can't find it.

1
where do you check your message in azure portal? you should click the Search button on the left blade of application insights resource on azure portal.Ivan Yang

1 Answers

3
votes

Update:

As per this doc -> in the note section, it mentions that "Note that by default setAutoCollectConsole is configured to exclude calls to console.log (and other console methods)".

So if you want to change this behavior to collect the console log, you should use this line of code: setAutoCollectConsole(true, true)


If you configure your node project correctly, then in the azure portal -> your application insights -> click the "Search" in the left blade:

enter image description here

then set the "Local time", and "Event type", at last click the "Refresh" button:

enter image description here

Or if you know application insights query, you can also click the "Logs(Analytics)" button to write your own log query code:

enter image description here