如何在Azure应用服务应用中查看console.log()输出 [英] How to view console.log() output in Azure app service app

查看:75
本文介绍了如何在Azure应用服务应用中查看console.log()输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个可在localhost:3000上正常运行的React应用.当我在Azure应用程序服务上部署并成功构建并启动时,错误是该应用程序在8080上没有响应.能够查看console.log的输出确实有助于查看该应用程序是否在正确的启动.移植与否!我已经配置了应用程序服务日志记录,但是没有日志消息.我认为std.err和std.out都应该出现在我可以从VS Code查看的docker日志中.有什么我想念的吗?

解决方案

在Azure Web应用程序中,端口仅支持80和443,通常我们定义 process.env.PORT ||.像这样的代码中的"3000" .

建议使用

通过git部署.

部署后.

设置 App服务日志.

检查日志流,您将找到 console.log 的内容.

I have a react app running fine on localhost:3000. When I deploy on Azure app service build and start up succeed but the error is that the app is not responding on 8080. Being able to view the output of console.log would really be a help to seeing whether the app is starting on the right port or not! I've configured app service logging but no log messages. I think both std.err and std.out should end up in the docker logs that I can view from VS Code. Is there something I could have missed?

解决方案

In azure webapp, the port only supports 80 and 443, usually we define process.env.PORT || '3000' in the code like this.

It is recommended to use continuous deployment to make the deployment process more convenient.

Test Sample code. (offical sample code)

I modify it for test.

Deploy by git.

After deployed.

Setting App Service logs.

Check Log stream, you will find the content of console.log.

这篇关于如何在Azure应用服务应用中查看console.log()输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆