# configure_debug_logging

> **Function** in `deepagents_code`

📖 [View in docs](https://reference.langchain.com/python/deepagents-code/_debug/configure_debug_logging)

Attach a file handler to *target* when `DEEPAGENTS_CODE_DEBUG` is set.

Intended to be called once on the `deepagents_code` package logger; child
module loggers reach the same file via propagation, so individual modules do
not configure logging themselves.

The log file defaults to `DEFAULT_DEBUG_FILE` but can be overridden with
`DEEPAGENTS_CODE_DEBUG_FILE`. The handler appends (`mode='a'`) so logs
are preserved across separate process runs. Calling this again with the same
resolved path is a no-op: the existing tagged handler is reused rather than
stacking duplicates. If the resolved path changes, the stale handler is
closed and replaced.

Does nothing when `DEEPAGENTS_CODE_DEBUG` is not truthy (see `is_env_truthy`).

## Signature

```python
configure_debug_logging(
    target: logging.Logger,
) -> None
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `target` | `logging.Logger` | Yes | Logger to configure. |

---

[View source on GitHub](https://github.com/langchain-ai/deepagents/blob/0412009c5441bef8d75a427e1da8909e33ab5b56/libs/code/deepagents_code/_debug.py#L26)