部署为app服务的node.js的Azure应用程序日志记录(blob)

Anu*_*pta 7 logging azure azure-web-app-service

我已将节点应用程序部署为azure app服务.并启用了日志级别为"详细"的azure应用程序日志记录(blob)并链接了blob类型的存储帐户.但是我的node.js console.log和console.error没有出现在blob中.我仍然继续在文件系统日志记录中获取stdout和stderr文件.

我的iisnode.yml文件具有以下内容 -

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
Run Code Online (Sandbox Code Playgroud)

Xav*_*ier 3

我现在正在尝试做完全相同的事情并遇到了这个:

对于 Node.js 网站,写入应用程序日志的方法是使用 console.log('message') 和 console.error('message') 写入控制台,该控制台将转到信息/错误级别日志条目。目前,node.js 日志文件唯一支持的目标是文件系统。

看来您无法在 Azure Web Apps 中使用 blob 存储来存储应用程序日志。然而,有适用于流行的 Nodejs 记录器(例如 Winston)的 Azure Blob 存储适配器: winston-azure-blob-transport

  • winston-azure-blob-transport 运行良好。我当前的解决方案是覆盖console.log/error,调用原始方法并使用winston 记录到blob 存储。 (2认同)