在本地运行功能时如何获取日志? [英] How to get logs while running functions locally?

查看:68
本文介绍了在本地运行功能时如何获取日志?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在通过azure-functions-core-tools v2.2.70在mac High Sierra上本地开发/调试我的Function App.我的应用基于Node.js 8.11.1.

当我的应用程序在Azure上发布时,我可以获得由context.log(示例消息")记录的日志,但是,当通过"func host start"在本地运行该应用程序时,我看不到任何我的海关记录.也就是说,如果我通过context.log记录某些内容 或console.log,我不会看到它.

我什至试过

Hi,

I'm developing / debugging my Function App locally on mac High Sierra by azure-functions-core-tools v2.2.70. My app is based on Node.js 8.11.1. 

When my app is published on Azure, I can get the logs which are logged by context.log("sample message"), however, while running the app locally by "func host start", I don't see any of my customs logs. That is, if I log something by context.log or console.log, I will not see it.

I even tried

NODE_OPTIONS=--inspect func host start


,但即使那样也无济于事.

您能告诉我如何获取自定义日志吗?因为没有日志,调试变得很困难.

仅供参考,在我的host.json中,我有以下内容:


, but even that didn't help.

Can you please tell me how can i get my custom logs? Because without logging, debugging gets difficult.

FYI, in my host.json, I have following:

  "tracing": {    "consoleLevel": "verbose"  }



谢谢




Thank you


推荐答案

你好 Mahdi 氮杂

Hello Mahdi aza,

我尝试过此文档 并按预期工作.希望您不要在这里错过任何一步.

I tried this document and it is working as expected. Hope you are not missing any step here.

此外,您还可以查看文档在Host.json中配置不同的日志级别.

Also, you check this document for different log levels configuration in Host.json.


这篇关于在本地运行功能时如何获取日志?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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