diff --git a/docs/platforms/php/guides/laravel/index.mdx b/docs/platforms/php/guides/laravel/index.mdx index a5f7498446daa3..ddc6aa04da4495 100644 --- a/docs/platforms/php/guides/laravel/index.mdx +++ b/docs/platforms/php/guides/laravel/index.mdx @@ -41,23 +41,22 @@ return Application::configure(basePath: dirname(__DIR__)) }) ->withExceptions(function (Exceptions $exceptions) { Integration::handles($exceptions); - })->create(); + }) + ->create(); ``` -Alternatively, you can configure Sentry in your [Laravel Log Channel](usage/#log-channels), allowing you to log `info` and `debug` as well. +Alternatively, you can configure Sentry as a [Laravel Log Channel](usage/#log-channels). ## Configure Configure the Sentry DSN with this command: - ```shell php artisan sentry:publish --dsn=___PUBLIC_DSN___ ``` It creates the config file (`config/sentry.php`) and adds the `DSN` to your `.env` file. - ```shell {filename:.env} SENTRY_LARAVEL_DSN=___PUBLIC_DSN___ ``` diff --git a/docs/platforms/php/guides/symfony/index.mdx b/docs/platforms/php/guides/symfony/index.mdx index f712d372373adc..f7dc760bd52401 100644 --- a/docs/platforms/php/guides/symfony/index.mdx +++ b/docs/platforms/php/guides/symfony/index.mdx @@ -17,11 +17,12 @@ Install the `sentry/sentry-symfony` bundle: composer require sentry/sentry-symfony ``` +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. + ## Configure Add your DSN to your `.env` file: - ```plain {filename:.env} ###> sentry/sentry-symfony ### SENTRY_DSN="___PUBLIC_DSN___" @@ -32,26 +33,6 @@ SENTRY_DSN="___PUBLIC_DSN___" In order to receive stack trace arguments in your errors, make sure to set `zend.exception_ignore_args: Off` in your php.ini -### Monolog Integration - -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: - -{/* */} -```yaml {filename:config/packages/sentry.yaml} -sentry: - register_error_listener: false # Disables the ErrorListener to avoid duplicated log in sentry - register_error_handler: false # Disables the ErrorListener, ExceptionListener and FatalErrorListener integrations of the base PHP SDK - -monolog: - handlers: - sentry: - type: sentry - level: !php/const Monolog\Logger::ERROR - hub_id: Sentry\State\HubInterface - fill_extra_context: true # Enables sending monolog context to Sentry - process_psr_3_messages: false # Disables the resolution of PSR-3 placeholders in reported messages -``` - ## Verify To test that both logger error and exception are correctly sent to sentry.io, you can create the following controller: diff --git a/docs/platforms/php/guides/symfony/integrations/monolog.mdx b/docs/platforms/php/guides/symfony/integrations/monolog.mdx index c6e25c034ed317..9168f7fb71a036 100644 --- a/docs/platforms/php/guides/symfony/integrations/monolog.mdx +++ b/docs/platforms/php/guides/symfony/integrations/monolog.mdx @@ -6,9 +6,13 @@ description: "Learn how to enable Sentry's Symfony SDK to capture Monolog events 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. 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. -```yaml +```yaml {filename:config/packages/sentry.yaml} +sentry: + register_error_listener: false # Disables the ErrorListener to avoid duplicated log in sentry + register_error_handler: false # Disables the ErrorListener, ExceptionListener and FatalErrorListener integrations of the base PHP SDK + services: - # Configure the breadcrumb handler as a service + # (Optionally) Configure the breadcrumb handler as a service (needed for the breadcrumb Monolog handler) Sentry\Monolog\BreadcrumbHandler: arguments: - '@Sentry\State\HubInterface' @@ -16,7 +20,7 @@ services: monolog: handlers: - # Register the breadcrumb handler as a Monolog handler + # (Optionally) Register the breadcrumb handler as a Monolog handler sentry_breadcrumbs: type: service name: sentry_breadcrumbs @@ -26,4 +30,6 @@ monolog: type: sentry level: !php/const Monolog\Logger::ERROR # Configures the level of messages to capture as events hub_id: Sentry\State\HubInterface + fill_extra_context: true # Enables sending monolog context to Sentry + process_psr_3_messages: false # Disables the resolution of PSR-3 placeholders in reported messages ```