Emitting logs via the SDK
The Sentry SDK provides a logging API that mirrors standard log levels. Enable log capture by settingenable_logs=True in your SDK configuration:
Log levels
Sentry recognizes the following log levels, from lowest to highest severity:| Level | Description |
|---|---|
trace | Very detailed diagnostic information |
debug | Diagnostic information useful during development |
info | Confirmation that things are working as expected |
warning | Something unexpected happened but the operation succeeded |
error | An error occurred that prevented an operation from completing |
fatal | A critical failure that may cause the application to crash |
Filtering logs
In the Logs section of Sentry you can:- Filter by log level (for example, show only
errorand above) - Search by message text or any structured attribute
- Filter by project, environment, and time range
- See the trace context associated with each log entry
Correlating logs with traces and errors
When a log message is emitted inside an active trace, Sentry automatically attaches the currenttrace_id, span_id, and transaction name to the log entry. This means:
- From a trace or span, you can see all log messages emitted during that operation.
- From a log entry, you can jump directly to the associated trace to see the full request context.
- From an error issue, the breadcrumbs panel shows log messages that occurred in the same session or trace before the error.
Sentry Logs is distinct from the breadcrumbs feature. Breadcrumbs are captured automatically by SDK integrations and shown on the issue detail page. Logs are explicit API calls that produce standalone log entries stored and queryable in the Logs section.