Azure / azure-iot-sdk-c

A C99 SDK for connecting devices to Microsoft Azure IoT services
https://azure.github.io/azure-iot-sdk-c
Other
587 stars 739 forks source link

Logs to Console just started #2504

Closed RandySRSOL closed 1 year ago

RandySRSOL commented 1 year ago

Ubuntu 20.04, Cross Compiled on Ubuntu 20.04 using GCC 9.4.0

Release LTS_01_2023_Ref02

After removing my build folder and doing a fresh build now running my app I'm seeing these strange logs to console.

Heres' some of them: -> Header (AMQP 0.1.0.0) <- Header (AMQP 0.1.0.0) -> [OPEN] {b2dcc7b2-b4ba-496d-9b41-1a6869da2804,vf-iot-hub.azure-devices.net,4294967295,65535,240000} <- [OPEN] {DeviceGateway_1731daea4384420db01debe47112ad26,localhost,65536,8191,120000,NULL,NULL,NULL,NULL,NULL} -> [BEGIN] {NULL,0,4294967295,100,4294967295} <- [BEGIN] {0,1,5000,4294967295,262143,NULL,NULL,NULL} -> [ATTACH] {$cbs-sender,0,false,0,0, {$cbs}, {$cbs},NULL,NULL,0,0} -> [ATTACH] {$cbs-receiver,1,true,0,0, {$cbs}, {$cbs},NULL,NULL,NULL,0} <- [ATTACH] {$cbs-sender,0,true,0,0, {$cbs,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, {$cbs,NULL,NULL,NULL,NULL,NULL,NULL},NULL,NULL,NULL,1048576,NULL,NULL,NULL} <- [FLOW] {0,5000,1,4294967295,0,0,100,0,NULL,false,NULL} -> [TRANSFER] {0,0,<01 00 00 00>,0,false,false} <- [ATTACH] {$cbs-receiver,1,false,0,0, {$cbs,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, {$cbs,NULL,NULL,NULL,NULL,NULL,NULL},NULL,NULL,0,1048576,NULL,NULL,NULL} -> [FLOW] {1,4294967295,1,99,1,0,10000} <- [DISPOSITION] {true,0,NULL,true, {},NULL} <- [TRANSFER] {1,0,<01 00 00 00>,0,NULL,false,NULL,NULL,NULL,NULL,false} -> [DISPOSITION] {true,0,0,true, {}}

Here is the CMake I'm using.

set(CMAKE_IOTHUB_ARGS "-Duse_prov_client=OFF -Dno_logging=ON")

ExternalProject_Add( azure-iot GIT_REPOSITORY https://github.com/Azure/azure-iot-sdk-c.git GIT_TAG "LTS_01_2023_Ref02" GIT_SHALLOW true PREFIX ${IOT_PREFIX} CMAKE_ARGS "${CMAKE_IOTHUB_ARGS}" INSTALL_COMMAND "" )

RandySRSOL commented 1 year ago

Any idea on the issue?

I also see a lot of -> [DETACH] {5,true} -> [DETACH] {6,true} -> [DETACH] {2,true} -> [DETACH] {3,true} -> [DETACH] {4,true} -> [DETACH] {0,true} -> [DETACH] {1,true} -> [END] {} -> [CLOSE]* {}

AND

-> Empty frame -> Empty frame -> Empty frame <- Empty frame -> Empty frame -> Empty frame -> Empty frame -> Empty frame

CIPop commented 1 year ago

I have tested this with code in our main branch and it works as expected when I'm using CMake (I prefer using ccmake):

image

Running iothub_client/samples/iothub_ll_telemetry_sample/iothub_ll_telemetry_sample.c doesn't give me any logs when the build is configured this way: image

With logging on (default), I get: image

It is very likely that the CMAKE_ARGS are not taking effect and you are building with defaults. Unfortunately, I'm not at all familiar with how ExternalProject_Add works.

I would first try out running cmake manually for our project and test with one of the samples, ensuring that all submodules have been properly updated and rebuilt (most logging above is from the uAMQP submodule dependency).

RandySRSOL commented 1 year ago

Thanks CIPop! that pointed me in the right direction. I needed to put double quotes around each arg.

set(CMAKE_IOTHUB_ARGS ${CMAKE_ARGS} "-Dno_logging=ON" "-Duse_prov_client=OFF" )