How to see Azure IoT SDK C logs using TI CC3235SF MCU on a serial monitor?

Y MRUDULA 41 Reputation points
2024-08-01T20:46:24.65+00:00

Hello!

I am using the TI CC3235SF MCU (custom board) and the Azure IoT SDK C (C language) to connect my gateway to Azure IoTHub.

I have set the "logtrace" option to true to get the logs using LL SetOption function.

I print out my debug logs onto a serial monitor via UART using the following print function -

   

void debug(const char *format, ...)

{

    char date[20];

    va_list args;

    va_start(args, format);

    while (pthread_mutex_trylock(&printfMutex))

    {

        usleep(5000);

    }

    struct timespec tspec;

    clock_gettime(CLOCK_REALTIME, &tspec);

    unsigned int hrs = tspec.tv_sec / (60*60);

    unsigned int min = (tspec.tv_sec - hrs6060) / 60;

    unsigned int sec = (tspec.tv_sec - hrs6060 - min*60);

    sprintf(date, "[%02d:%02d:%02d.%03d] ", hrs % 24, min, sec, tspec.tv_nsec / 1000000);

    fprintf(stderr, "%s", date);

    vfprintf(stderr, format, args);

    va_end(args);

    pthread_mutex_unlock(&printfMutex);

}

   

I want to see extensive Azure IoT SDK logs such as shown below-

How to enable such detailed logs? Do I need to do anything else other than setting the "logtrace" option to true?

-> 14:36:13 CONNECT | VER: 4 | KEEPALIVE: 240 | FLAGS: 192 | USERNAME: [...] | PWD: XXXX | CLEAN: 0
<- 14:36:13 CONNACK | SESSION_PRESENT: false | RETURN_CODE: 0x3
Azure IoT SDK
Azure IoT SDK
An Azure software development kit that facilitates building applications that connect to Azure IoT services.
223 questions
0 comments No comments
{count} votes

Accepted answer
  1. Sander van de Velde | MVP 33,146 Reputation points MVP
    2024-08-02T06:16:26.41+00:00

    Hello @Y MRUDULA,

    welcome to this moderated Azure community forum.

    This SDK is hosted on GitHub as an open source project.

    If you want to ask detailed questions, the creators/moderators of that repository are in a better position to answer them.

    Just create an issue over there and cross reference that one here.


    If the response helped, do "Accept Answer". If it doesn't work, please let us know the progress. All community members with similar issues will benefit by doing so. Your contribution is highly appreciated.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.