]> BookStack Code Mirror - bookstack/blob - app/Config/logging.php
Framework: Upgrade from Laravel 9 to 10
[bookstack] / app / Config / logging.php
1 <?php
2
3 use Monolog\Formatter\LineFormatter;
4 use Monolog\Handler\ErrorLogHandler;
5 use Monolog\Handler\NullHandler;
6 use Monolog\Handler\StreamHandler;
7 use Monolog\Processor\PsrLogMessageProcessor;
8
9 /**
10  * Logging configuration options.
11  *
12  * Changes to these config files are not supported by BookStack and may break upon updates.
13  * Configuration should be altered via the `.env` file or environment variables.
14  * Do not edit this file unless you're happy to maintain any changes yourself.
15  */
16
17 return [
18
19     // Default Log Channel
20     // This option defines the default log channel that gets used when writing
21     // messages to the logs. The name specified in this option should match
22     // one of the channels defined in the "channels" configuration array.
23     'default' => env('LOG_CHANNEL', 'single'),
24
25     // Deprecations Log Channel
26     // This option controls the log channel that should be used to log warnings
27     // regarding deprecated PHP and library features. This allows you to get
28     // your application ready for upcoming major versions of dependencies.
29     'deprecations' => [
30         'channel' => 'null',
31         'trace' => false,
32     ],
33
34     // Log Channels
35     // Here you may configure the log channels for your application. Out of
36     // the box, Laravel uses the Monolog PHP logging library. This gives
37     // you a variety of powerful log handlers / formatters to utilize.
38     // Available Drivers: "single", "daily", "slack", "syslog",
39     //                    "errorlog", "monolog",
40     //                    "custom", "stack"
41     'channels' => [
42         'stack' => [
43             'driver'            => 'stack',
44             'channels'          => ['daily'],
45             'ignore_exceptions' => false,
46         ],
47
48         'single' => [
49             'driver' => 'single',
50             'path'   => storage_path('logs/laravel.log'),
51             'level'  => 'debug',
52             'days'   => 14,
53             'replace_placeholders' => true,
54         ],
55
56         'daily' => [
57             'driver' => 'daily',
58             'path'   => storage_path('logs/laravel.log'),
59             'level'  => 'debug',
60             'days'   => 7,
61             'replace_placeholders' => true,
62         ],
63
64         'stderr' => [
65             'driver'  => 'monolog',
66             'level'   => 'debug',
67             'handler' => StreamHandler::class,
68             'with'    => [
69                 'stream' => 'php://stderr',
70             ],
71             'processors' => [PsrLogMessageProcessor::class],
72         ],
73
74         'syslog' => [
75             'driver' => 'syslog',
76             'level'  => 'debug',
77             'facility' => LOG_USER,
78             'replace_placeholders' => true,
79         ],
80
81         'errorlog' => [
82             'driver' => 'errorlog',
83             'level'  => 'debug',
84             'replace_placeholders' => true,
85         ],
86
87         // Custom errorlog implementation that logs out a plain,
88         // non-formatted message intended for the webserver log.
89         'errorlog_plain_webserver' => [
90             'driver'         => 'monolog',
91             'level'          => 'debug',
92             'handler'        => ErrorLogHandler::class,
93             'handler_with'   => [4],
94             'formatter'      => LineFormatter::class,
95             'formatter_with' => [
96                 'format' => '%message%',
97             ],
98             'replace_placeholders' => true,
99         ],
100
101         'null' => [
102             'driver'  => 'monolog',
103             'handler' => NullHandler::class,
104         ],
105
106         // Testing channel
107         // Uses a shared testing instance during tests
108         // so that logs can be checked against.
109         'testing' => [
110             'driver' => 'testing',
111         ],
112
113         'emergency' => [
114             'path' => storage_path('logs/laravel.log'),
115         ],
116     ],
117
118     // Failed Login Message
119     // Allows a configurable message to be logged when a login request fails.
120     'failed_login' => [
121         'message' => env('LOG_FAILED_LOGIN_MESSAGE', null),
122         'channel' => env('LOG_FAILED_LOGIN_CHANNEL', 'errorlog_plain_webserver'),
123     ],
124
125 ];