【问题标题】:How do i get log output from Node.Js app runnng on Azure App Service Linux?如何从 Azure App Service Linux 上运行的 Node.Js 应用获取日志输出?
【发布时间】:2018-10-16 12:30:49
【问题描述】:

我正在 Linux 上的 Azure 应用服务上运行 express.js 应用(启动 Nuxt 应用程序),并且在请求某些页面时遇到应用程序错误。

如何从 Linux 上的 Azure 中的节点获取控制台输出?提供的日志似乎都没有给我节点跟踪和控制台日志输出,那么我该如何解决错误?

我的server.js 看起来像这样:

const express = require('express')
const {Nuxt} = require('nuxt')


const app = express()
const port = process.env.PORT || 3000
// Import and set Nuxt.js options
let config = require('./nuxt.config.js')
config.dev = false;
const nuxt = new Nuxt(config)
// Give Nuxt middleware to express
app.use(nuxt.render)
// Listen the server
app.listen(port);
console.log('Server listening on :' + port);

【问题讨论】:

    标签: node.js azure azure-web-app-service nuxt.js


    【解决方案1】:

    转到此网址: https://[project-name].scm.azurewebsites.net/ 此 url 链接在“高级工具”下的 Azure App Services 项目中。

    有一个指向当前 Docker 日志的链接。 在这个文件中你可以找到与 nodejs 和 express 相关的错误。

    【讨论】:

    • 但这并没有告诉我任何事情......它只说:2018-10-16 05:27:48.733 INFO - 站点的启动容器 2018-10-16 05:27:48.733 INFO - docker run -d -p 1111:8080 --name x_0 -e WEBSITE_NODE_DEFAULT_VERSION=8.11 -e APPSETTING_WEBSITE_NODE_DEFAULT_VERSION=8.11 -e WEBSITES_PORT=3000 -e WEBSITE_SITE_NAME=x -e WEBSITE_AUTH_ENABLED=False -e WEBSITE_ROLE_T e HTTP_LOGGING_ENABLED=1 appsvc/node:8.11.2_1805212105 $NPM_CMD 运行构建; $NPM_CMD 开始
    【解决方案2】:

    【讨论】:

    • 这篇文章似乎适用于在 Windows 而不是 Linux 上运行 node.js 的 Web 应用程序。例如我在 LogFiles 下没有看到任何名为“Application”的文件夹?
    • 这是我们为 linux 提供的内容。 blogs.msdn.microsoft.com/azureossds/2018/08/30/…
    猜你喜欢
    • 1970-01-01
    • 2018-07-16
    • 2019-10-25
    • 2022-01-22
    • 2022-06-16
    • 2021-01-09
    • 1970-01-01
    • 1970-01-01
    • 2021-12-09
    相关资源
    最近更新 更多