Choose a Safe Sentry Logging Setup for Symfony

Unofficial preview — not affiliated with Sentry. This prototype is based only on public Sentry documentation and source code. Verify it against the current official documentation before production use.

Choose the signal you need#

Goal Use What reaches Sentry
Investigate unhandled failures Automatic exception capture An error event with exception context
Search application messages as a dataset Structured Logs Each accepted Monolog record becomes a searchable log
Add context to a later error Breadcrumbs The message is stored locally and attached to a later event

Structured Logs require Sentry Symfony SDK 5.4.0 or later. The Symfony Logs handler accepts a minimum Monolog level, so a production rollout can start at warning instead of forwarding every debug or info message.

Avoid duplicate or unexpected ingestion#

Adding a Logs handler does not replace exception capture. If the same failure is emitted as an exception event and also written through Monolog, both signals can reach Sentry.

Before enabling Logs in production:

  1. List the Monolog channels that will reach the handler.
  2. Choose the minimum level.
  3. Exclude expected exceptions from error capture.
  4. Drop noisy structured logs with before_send_log.
  5. Test representative traffic and inspect the resulting volume.

Start with automatic exception capture for unexpected failures. Add Structured Logs only to channels whose messages you intend to search and analyze.

Choose a logging mode or apply the safe production configuration.

Sources#

Updated

Was this page helpful?