Skip to content

Commit cf943e2

Browse files
committed
Merge and move Symfony Monolog docs
1 parent 805e7eb commit cf943e2

File tree

2 files changed

+7
-22
lines changed

2 files changed

+7
-22
lines changed

docs/platforms/php/guides/symfony/index.mdx

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@ Install the `sentry/sentry-symfony` bundle:
1717
composer require sentry/sentry-symfony
1818
```
1919

20+
If you are using [Monolog](https://github.com/Seldaek/monolog) to report events instead of the typical error listener approach, you need this [additional configuration](integrations/monolog/) to log the errors correctly.
21+
2022
## Configure
2123

2224
Add your DSN to your `.env` file:
2325

24-
2526
```plain {filename:.env}
2627
###> sentry/sentry-symfony ###
2728
SENTRY_DSN="___PUBLIC_DSN___"
@@ -32,26 +33,6 @@ SENTRY_DSN="___PUBLIC_DSN___"
3233
In order to receive stack trace arguments in your errors, make sure to set `zend.exception_ignore_args: Off` in your php.ini
3334
</Alert>
3435

35-
### Monolog Integration
36-
37-
If you are using [Monolog](https://github.com/Seldaek/monolog) to report events instead of the typical error listener approach, you need this additional configuration to log the errors correctly:
38-
39-
{/* <!-- prettier-ignore --> */}
40-
```yaml {filename:config/packages/sentry.yaml}
41-
sentry:
42-
register_error_listener: false # Disables the ErrorListener to avoid duplicated log in sentry
43-
register_error_handler: false # Disables the ErrorListener, ExceptionListener and FatalErrorListener integrations of the base PHP SDK
44-
45-
monolog:
46-
handlers:
47-
sentry:
48-
type: sentry
49-
level: !php/const Monolog\Logger::ERROR
50-
hub_id: Sentry\State\HubInterface
51-
fill_extra_context: true # Enables sending monolog context to Sentry
52-
process_psr_3_messages: false # Disables the resolution of PSR-3 placeholders in reported messages
53-
```
54-
5536
## Verify
5637

5738
To test that both logger error and exception are correctly sent to sentry.io, you can create the following controller:

docs/platforms/php/guides/symfony/integrations/monolog.mdx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ description: "Learn how to enable Sentry's Symfony SDK to capture Monolog events
66
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.
77
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.
88

9-
```yaml
9+
```yaml {filename:config/packages/sentry.yaml}
10+
sentry:
11+
register_error_listener: false # Disables the ErrorListener to avoid duplicated log in sentry
12+
register_error_handler: false # Disables the ErrorListener, ExceptionListener and FatalErrorListener integrations of the base PHP SDK
13+
1014
services:
1115
# Configure the breadcrumb handler as a service
1216
Sentry\Monolog\BreadcrumbHandler:

0 commit comments

Comments
 (0)