我在azure上部署了一个nodejs web app作为App Service
我如何从我的应用程序中看到console.log?
您可以使用Azure CLI拖尾日志...
$ az webapp log tail --name <name of webapp> --resource-group <name of resource group>
更多信息here
我只是按照Enable diagnostics logging启用应用程序日志(文件系统),应用程序日志(Blob),发现console.log
和console.error
将在D:\home\LogFiles\Application\
下输出日志,你可以使用KUDU查看你的日志文件,或者你也可以访问https://{your-app-name}.scm.azurewebsites.net/api/vfs/LogFiles/Application/index.html
并检查stdout和stderr类型如下:
此外,正如Azure Web App (Website) Logging - Tips and Tools提到的node.js的应用程序日志如下:
在Azure门户中设置应用程序日志
对于node.js网站,编写应用程序日志的方法是使用console.log('message')和console.error('message')写入控制台,该控制台转到信息/错误级别日志条目。目前,node.js的日志文件唯一受支持的目标是文件系统。
应用程序日志功能不支持其他网站类型,如php和python。
要登录blob,您可以利用winston-azure-blob-transport将Node.js Web应用程序中的应用程序日志收集到Azure Blob存储中。