【问题标题】:Understanding Azure IoT Edge Modules了解 Azure IoT Edge 模块
【发布时间】:2019-02-13 12:48:20
【问题描述】:

我是 Azure 和 IoT Edge 的新手,我正在尝试了解模块的工作原理。

我遵循了这个很好的教程 (https://docs.microsoft.com/en-us/azure/iot-edge/tutorial-c-module),一切似乎都运行正常。

我的问题是关于代码中的printf。 (例如这里的第 3 点:https://docs.microsoft.com/en-us/azure/iot-edge/tutorial-c-module#update-the-module-with-custom-code

if (NULL == messageInstance)
{
    printf("Failed allocating 'MESSAGE_INSTANCE' for pipelined message\r\n");
}

输出在哪里打印?

通常它会在标准输出上,但我的模块在虚拟机的后台运行。显然我可以访问这个虚拟机。怎么看?

这对我来说很棒,以便更好地了解模块如何协同工作以及如何与 IoT 中心通信。

谢谢你帮助我

【问题讨论】:

    标签: c azure printf azure-iot-hub azure-iot-edge


    【解决方案1】:

    输出被写入模块日志文件。您可以通过使用 ssh 登录到您的虚拟机然后使用以下命令来检查它:

    sudo iotedge logs <yourModuleName>
    

    添加 -f 选项使其跟随新输出,使用 --tail 您可以将输出限制为日志文件的最后几行。

    sudo iotedge logs <yourModuleName> -f --tail 100
    

    显示日志文件的最后 100 行并添加新的输出。

    【讨论】:

    • 非常感谢这个明确的答案,正是我想要的。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-12-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多