diff --git a/platform-includes/logs/setup/php.laravel.mdx b/platform-includes/logs/setup/php.laravel.mdx index 1d651b081c7b6..1448f11fa6b08 100644 --- a/platform-includes/logs/setup/php.laravel.mdx +++ b/platform-includes/logs/setup/php.laravel.mdx @@ -1,18 +1,4 @@ -To configure Sentry as a log channel, add the following config to the `channels` section in `config/logging.php`. If this file does not exist, run `php artisan config:publish logging` to publish it. - -```php {filename:config/logging.php} -'channels' => [ - // ... - 'sentry_logs' => [ - 'driver' => 'sentry_logs', - // The minimum logging level at which this handler will be triggered - // Available levels: debug, info, notice, warning, error, critical, alert, emergency - 'level' => env('LOG_LEVEL', 'info'), // defaults to `debug` if not set - ], -], -``` - -After you configured the Sentry log channel, you can configure your app to both log to a log file and to Sentry by modifying the log stack: +To configure Sentry logs, you need to set the following variables in your `.env` file: ```bash {filename:.env} # ... @@ -29,4 +15,34 @@ SENTRY_ENABLE_LOGS=true # ... ``` +You can configure your log level by setting `LOG_LEVEL` or if you want a log level just for Sentry, you can use +`SENTRY_LOG_LEVEL`: + +```bash {filename:.env} +# ... +LOG_LEVEL=info # defaults to debug +SENTRY_LOG_LEVEL=warning # defaults to LOG_LEVEL +# ... +``` + Also make sure your `config/sentry.php` file is up to date. You can find the latest version on [GitHub](https://github.com/getsentry/sentry-laravel/blob/master/config/sentry.php). + + + +If you are using the Sentry Laravel SDK version `4.16.0` or lower, you need to configure the log channel manually as described below. + + + +To configure Sentry as a log channel, add the following config to the `channels` section in `config/logging.php`. If this file does not exist, run `php artisan config:publish logging` to publish it. + +```php {filename:config/logging.php} +'channels' => [ + // ... + 'sentry_logs' => [ + 'driver' => 'sentry_logs', + // The minimum logging level at which this handler will be triggered + // Available levels: debug, info, notice, warning, error, critical, alert, emergency + 'level' => env('LOG_LEVEL', 'info'), // defaults to `debug` if not set + ], +], +```