Skip to content

Commit 7772873

Browse files
committed
Add a Sentry SDK guide how to configure the Monolog handler
1 parent 080ab72 commit 7772873

File tree

1 file changed

+29
-0
lines changed
  • docs/platforms/php/guides/symfony/integrations

1 file changed

+29
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
title: Monolog
3+
description: "Learn how to enable Sentry's Symfony SDK to capture Monolog events."
4+
---
5+
6+
When using [Monolog](https://github.com/Seldaek/monolog) you can configure a [breadcrumb](../../enriching-events/breadcrumbs/) handler to capture Monolog messages as breadcrumbs and a handler that captures messages as events in Sentry.
7+
The breadcrumb handler will not send anything to Sentry directly, it only records breadcrumbs that will be attached to any event or exception sent to Sentry.
8+
9+
```yaml
10+
services:
11+
# Configure the breadcrumb handler as a service
12+
Sentry\Monolog\BreadcrumbHandler:
13+
arguments:
14+
- '@Sentry\State\HubInterface'
15+
- !php/const Monolog\Logger::INFO # Configures the level of messages to capture as breadcrumbs
16+
17+
monolog:
18+
handlers:
19+
# Register the breadcrumb handler as a Monolog handler
20+
sentry_breadcrumbs:
21+
type: service
22+
name: sentry_breadcrumbs
23+
id: Sentry\Monolog\BreadcrumbHandler
24+
# Register the handler as a Monolog handler to capture messages as events
25+
sentry:
26+
type: sentry
27+
level: !php/const Monolog\Logger::ERROR # Configures the level of messages to capture as events
28+
hub_id: Sentry\State\HubInterface
29+
```

0 commit comments

Comments
 (0)