# Configure logging to debug applications

The Qualcomm AI Inference Suite SDK uses [standard Python logging](https://docs.python.org/3/howto/logging.html)
to help you debug applications. Configure the logger using the logger
name `imagine`. If the logging level is set
to [`DEBUG`](https://docs.python.org/3/howto/logging.html#logging-levels), the library logs the HTTP requests sent to the Imagine API.

The following code sample shows how you can configure logging to generate debug messages and print them to the console.

import logging.config
    
    from imagine import ChatMessage, ImagineClient
    
    logging.config.dictConfig(
        {
            "version": 1,
            "disable_existing_loggers": False,
            "formatters": {
                "standard": {
                    "format": "%(name)s: %(message)s",
                },
            },
            "handlers": {
                "console": {
                    "class": "logging.StreamHandler",
                    "level": "DEBUG",
                    "formatter": "standard",
                },
            },
            "loggers": {
                "imagine": {
                    "handlers": ["console"],
                    "level": "DEBUG",
                    "propagate": False,
                },
            },
            "root": {
                "handlers": ["console"],
                "level": "INFO",
            },
        }
    )
    
    client = ImagineClient()
    
    chat_response = client.chat(
        messages=[ChatMessage(role="user", content="What is the best Spanish cheese?")],
    )  # This method call will generate a logging record
    
    print(chat_response.first_content)
    Copy to clipboard

For quick debugging when you do not need the comprehensive debugging in the standard Python logging, another way to configure logging is to enable simple plain text logging to `stdout` by doing one of the following:

- Setting the environment variable `IMAGINE_DEBUG` to a truthy value, such as `1`, `true`, or `yes`.
- Passing `debug=True` when creating an instance of the client class.

The following example shows how to pass `debug=True`.

from imagine import ChatMessage, ImagineClient
    
    client = ImagineClient(debug=True)
    
    chat_response = client.chat(
        messages=[ChatMessage(role="user", content="What is the best Spanish cheese?")],
    )  # This method call will generate a logging record
    
    print(chat_response.first_content)
    Copy to clipboard

## Next steps

- Review [basic functionality on how to start a chat, complete code, and generate embeddings](https://docs.qualcomm.com/doc/80-88545-1/topic/1_0_basic_usage.html).
- [Connect models to external systems with tool calling](https://docs.qualcomm.com/doc/80-88545-1/topic/2_0_tool_calling.html).

Last Published: Apr 17, 2026

[Previous Topic
Add guardrails to an LLM](https://docs.qualcomm.com/bundle/publicresource/80-88545-1/topics/guarded_llm_example.md) [Next Topic
SDK API reference](https://docs.qualcomm.com/bundle/publicresource/80-88545-1/topics/index_api.md)