> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mudraid.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Debug with structured logs

> Turn on the SDK's logs to see exactly what the trust loop is doing.

When a call isn't behaving, the SDK's logs show you each step of the trust loop — resolving the platform, minting a token, retrying on expiry. Turning them on is the fastest way to see where something breaks.

## Turn on logging

The SDK logs through Python's standard `logging`. Set its level to `DEBUG`:

```python theme={null}
import logging
logging.getLogger("mudraid").setLevel(logging.DEBUG)
```

That enables everything under the `mudraid` namespace. Wire it to a handler if you don't already have logging configured:

```python theme={null}
logging.basicConfig(level=logging.INFO)        # your app
logging.getLogger("mudraid").setLevel(logging.DEBUG)   # verbose just for the SDK
```

## The loggers, and what each tells you

Each part of the SDK logs under its own name, so you can zoom in on one stage.

| Logger                      | What it shows                         | Useful when                      |
| --------------------------- | ------------------------------------- | -------------------------------- |
| `mudraid.agent`             | Request lifecycle, 401 retries        | A call behaves unexpectedly      |
| `mudraid.token_manager`     | Token cache hits, mints, refreshes    | You suspect a token/expiry issue |
| `mudraid.platform_resolver` | Bootstrap, host → platform resolution | `PlatformNotRegistered` errors   |
| `mudraid.http`              | Outbound requests to MudraID          | MudraID connectivity problems    |
| `mudraid.env`               | `.env` loading                        | Credentials "not found"          |

Narrow to a single stage when the rest is noise:

```python theme={null}
logging.getLogger("mudraid.token_manager").setLevel(logging.DEBUG)
```

## Reading the output

A healthy first call typically shows: env loaded → platform resolved → token minted → request sent → `200`. If it stops early, the last line points at the stage that failed — for example, a `platform_resolver` line with no following `token_manager` mint usually means the host isn't a registered platform.

## Logs never contain secrets

No SDK log line emits a secret or a token, at any level. This is enforced by tests that scan the entire DEBUG output for credential strings on every build — so you can leave DEBUG on and ship the logs to an aggregator without leaking credentials.

## Related

* [Handle errors](/guides/agent-developer/error-handling)
* [Diagnostics reference](/sdks/python-sdk/diagnostics)
