Skip to content

Commit 5c12959

Browse files
authored
ref: add docs that logs channel is optional (#15172)
1 parent 935b95a commit 5c12959

File tree

1 file changed

+31
-15
lines changed

1 file changed

+31
-15
lines changed
Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,4 @@
1-
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.
2-
3-
```php {filename:config/logging.php}
4-
'channels' => [
5-
// ...
6-
'sentry_logs' => [
7-
'driver' => 'sentry_logs',
8-
// The minimum logging level at which this handler will be triggered
9-
// Available levels: debug, info, notice, warning, error, critical, alert, emergency
10-
'level' => env('LOG_LEVEL', 'info'), // defaults to `debug` if not set
11-
],
12-
],
13-
```
14-
15-
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:
1+
To configure Sentry logs, you need to set the following variables in your `.env` file:
162

173
```bash {filename:.env}
184
# ...
@@ -29,4 +15,34 @@ SENTRY_ENABLE_LOGS=true
2915
# ...
3016
```
3117

18+
You can configure your log level by setting `LOG_LEVEL` or if you want a log level just for Sentry, you can use
19+
`SENTRY_LOG_LEVEL`:
20+
21+
```bash {filename:.env}
22+
# ...
23+
LOG_LEVEL=info # defaults to debug
24+
SENTRY_LOG_LEVEL=warning # defaults to LOG_LEVEL
25+
# ...
26+
```
27+
3228
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).
29+
30+
<Alert title="Note">
31+
32+
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.
33+
34+
</Alert>
35+
36+
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.
37+
38+
```php {filename:config/logging.php}
39+
'channels' => [
40+
// ...
41+
'sentry_logs' => [
42+
'driver' => 'sentry_logs',
43+
// The minimum logging level at which this handler will be triggered
44+
// Available levels: debug, info, notice, warning, error, critical, alert, emergency
45+
'level' => env('LOG_LEVEL', 'info'), // defaults to `debug` if not set
46+
],
47+
],
48+
```

0 commit comments

Comments
 (0)