Azure Sphere logging

Kiran Pradeep 106 Reputation points
2020-10-29T10:27:32.993+00:00

For Sphere devices, we can vscode/cli to deploy, debug and see logs of the application [1]. But later (say I kept it running for 24 hours and comes back), if I wish to see application logs, it looks like, I don't have a way. Is there a way to see application logs on Sphere development boards without initiating the debugger?

To be clear, this is not about monitoring applications deployed in production [2]. This is only about development logs on Azure Sphere development boards. An example is logcat in Android [3]. The intention is to analyse long running application on Azure Sphere. We cannot keep the debugger attached forever.

Azure Sphere
Azure Sphere
An Azure internet of things security solution including hardware, operating system, and cloud components.
156 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. António Sérgio Azevedo 7,661 Reputation points Microsoft Employee
    2020-10-29T16:27:45.19+00:00

    Hello @Kiran Pradeep ,
    Please check the article on Best Practices for high-level applications - Error handling and logging

    For your case, where you want to analyse long running application on Azure Sphere without attaching the debugger the best and recommended approach is to send the value of the errno variable through D2C messages to an IoT Hub.

    ===UPDATE====

    Alternatively you can capture/redirect the output stream to a file:
    https://learn.microsoft.com/en-us/azure-sphere/app-development/manual-build#debug-the-application

    36875-image.png

    You don’t actually need to use gdb/debugger to access this output stream from a connected device. A terminal client reading that stream can save/redirect their output to file.

    Remember:

    • Please accept an answer if correct. Original posters help the community find answers faster by identifying the correct answer. Here is how.
    • Want a reminder to come back and check responses? Here is how to subscribe to a notification.
    2 people found this answer helpful.