How to get rid of log messages from Azure IOT SDK?

Pandey, Yogesh 21 Reputation points
2022-03-09T15:49:11.367+00:00

Hi,

I am using Azure IOT SDK for creating Azure connector service.
However, I getting lot of log messages. Is there a way to get rid of these messages. ?

181508-image.png

Azure IoT
Azure IoT
A category of Azure services for internet of things devices.
378 questions
Azure IoT Edge
Azure IoT Edge
An Azure service that is used to deploy cloud workloads to run on internet of things (IoT) edge devices via standard containers.
534 questions
Azure IoT Hub
Azure IoT Hub
An Azure service that enables bidirectional communication between internet of things (IoT) devices and applications.
1,115 questions
Azure IoT SDK
Azure IoT SDK
An Azure software development kit that facilitates building applications that connect to Azure IoT services.
207 questions
0 comments No comments
{count} votes

Accepted answer
  1. QuantumCache 20,031 Reputation points
    2022-03-10T22:28:48.977+00:00

    Hello @Pandey, Yogesh ,

    We don't currently have any kind of dynamic way to turn it on or off directly within the client, it's purely based on logging configuration.

    Somewhere in the application a line that is something like: logging.basicConfig(level=logging.INFO) You need to remove that line.

    Try to avoid the below log levels if already used (DEBUG, INFO, WARNING, or ERROR):

    import logging  
    logging.basicConfig(level=logging.INFO)  
    

    or, for an individual component:

    import logging  
    logging.getLogger("azure.iot.device").setLevel(level=logging.DEBUG)  
    

    Additional readings: Register a log stream handler
    Github related issues: https://github.com/Azure/azure-iot-sdk-python/issues/382#issuecomment-558221236

    Please comment in the below section to get more help in this matter, happy to help.

    Please accept the helpful response as 'Answer', which will be helpful to others as well with similar questions


1 additional answer

Sort by: Most helpful
  1. Sander van de Velde 28,236 Reputation points MVP
    2022-03-09T18:05:26.773+00:00

    Hello

    it seems you are working with the Azure IoT SDK for Python.

    I'm not sure why you have so many exceptions, this is not common to what I have seen in the past.

    Can you please try out this sample application (GitHub) in comparison?