Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 31 additions & 15 deletions platform-includes/logs/setup/php.laravel.mdx
Original file line number Diff line number Diff line change
@@ -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}
# ...
Expand All @@ -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).

<Alert title="Note">

If you’re using the Sentry Laravel SDK version `4.16.0` and below, or if you want to define the channel yourself to pass additional options, configure the log channel manually as described below.

</Alert>

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
],
],
```
Loading