Skip to content
Draft
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
48 changes: 31 additions & 17 deletions platform-includes/logs/setup/php.laravel.mdx
Original file line number Diff line number Diff line change
@@ -1,20 +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:

```bash {filename:.env}
import {Alert} from "../../../src/components/alert";```bash {filename:.env}
# ...
LOG_CHANNEL=stack
LOG_STACK=single,sentry_logs
Expand All @@ -29,4 +13,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 are using the Sentry Laravel SDK version `4.16.0` or lower, you need to 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