Sentry Python SDK 3.0: Logging Stopped Working

After upgrading to Sentry’s Python SDK 3.0, logger.error() and logger.exception() can stop creating issues while capture_exception() still works. Two defaults changed: the logging integration is now opt-in, and it no longer creates error events unless you set event_level.

Restore error events

For an application sending errors to Bugsink, set SENTRY_DSN to your project’s DSN and initialize the SDK like this:

import logging
import os
import sentry_sdk
from sentry_sdk.integrations.logging import LoggingIntegration

sentry_sdk.init(
    dsn=os.environ["SENTRY_DSN"],
    integrations=[
        LoggingIntegration(
            level=None,
            event_level=logging.ERROR,
            breadcrumb_level=logging.INFO,
        ),
    ],
    traces_sample_rate=0,
    send_client_reports=False,
    auto_session_tracking=False,
)

event_level=logging.ERROR sends ERROR and CRITICAL records as events. breadcrumb_level=logging.INFO keeps INFO and higher records as context on subsequent events.

The level=None setting disables Sentry’s separate structured log stream, which Bugsink does not process. If you use Sentry and want that stream too, set level to your desired log threshold instead.

The level argument

In SDK 2.x, the logging integration was enabled by default and its level argument controlled breadcrumbs. In 3.x, that argument controls Sentry logs; the breadcrumb threshold moved to breadcrumb_level.

This means passing level=logging.INFO to LoggingIntegration() still sends data, but does not create error events. A breadcrumb only adds context to a later event. Sentry logs are a separate product from error tracking.

Check logging delivery

After initialization, run:

logging.basicConfig(level=logging.INFO)
logger = logging.getLogger("checkout")

logger.info("Starting checkout")
logger.error("Payment provider unavailable")
sentry_sdk.flush(timeout=10)

In Bugsink, find Payment provider unavailable. Its event should include Starting checkout as a breadcrumb. basicConfig() makes this standalone example emit INFO records; your existing application can keep its own logging configuration.

If the error is still missing, check the logger’s effective level and filters, then before_send and the SDK’s error sample_rate. A direct capture_exception() call helps distinguish a logging problem from a delivery problem.

Loguru

Loguru has the same two changes. In the initialization above, replace the logging integration with:

from sentry_sdk.integrations.loguru import LoguruIntegration

integrations=[
    LoguruIntegration(
        level=None,
        event_level="ERROR",
        breadcrumb_level="INFO",
    ),
],

Both logging examples were tested with SDK 3.0.0 and 3.0.1 against Bugsink 2.7.1, including the breadcrumb on the error event. The Bugsink migration reference covers the other SDK 3.0 changes.