Logging

Set ICEAXE_LOG_LEVEL=DEBUG during development to see the SQL Iceaxe sends to Postgres:

ICEAXE_LOG_LEVEL=DEBUG uv run runserver

This results in a lot of output, so you may want to pipe it to a file:

ICEAXE_LOG_LEVEL=DEBUG uv run runserver > debug.log

Each entry is a single line of JSON containing the timestamp, level, and message. You can parse these logs with your usual JSON tools.

{"level": "DEBUG", "name": "iceaxe", "timestamp": "2021-10-14 15:00:00,000", "message": "SELECT * FROM users WHERE id = 1"}

Query failure context

When a query fails, DBConnection.exec() raises IceaxeQueryError. The exception message includes the rendered SQL and bound variables, even when debug logging is disabled.

Iceaxe preserves the original asyncpg exception hierarchy, so you can still catch specific driver errors such as asyncpg.UniqueViolationError and still read the query context.