Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure application logging(blob) for node.js deployed as app service

I have deployed a node application as azure app service. And enabled azure Application Logging(blob) with log level "Verbose" and linked a storage account of type blob. But my node.js console.log and console.error do not appear in the blob. I still keep on getting stdout and stderr file in file system logging.

My iisnode.yml file has the following content-

nodeProcessCommandLine: "D:\Program Files (x86)\nodejs\6.3.0\node.exe"
nodeProcessCountPerApplication: 2
loggingEnabled: true
logDirectory: iisnode
maxLogFiles: 100
devErrorsEnabled: true
configOverrides: "iisnode.yml"
asyncCompletionThreadCount: 20
flushResponse: true
like image 609
Anup Das Gupta Avatar asked Oct 31 '16 18:10

Anup Das Gupta


People also ask

Which methods allow you to access the application logs in Azure App Service?

To enable application logging for Windows apps in the Azure portal, navigate to your app and select App Service logs. Select On for either Application Logging (Filesystem) or Application Logging (Blob), or both.

How do I view logs of APP service in Azure?

That's pretty much it. Now you can simply visit your application using the URL you can see on your Azure dashboard. On the portal, click on “Log Stream” immediately below “App Services log” and you'll see the log messages in real time.


Video Answer


1 Answers

I'm trying to do the exact same thing right now and came across this:

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.

It looks as though you can't use blob storage for application logs in Azure Web Apps. There are however Azure blob storage adapters for popular nodejs loggers such as winston: winston-azure-blob-transport

like image 62
Xavier Avatar answered Oct 27 '22 01:10

Xavier