logging.php file contains log file configuration items. This document provides an list of configuration items available in the file, allowing you to modify them as necessary.
For details on how to set the below configuration items, please create a
/config/production/logging.php file and read: Updating Config Files.
The relevant channels to edit are:
emaillog- the verbose email log, which has to be enabled under the email channel settings.
querylog- all SQL queries, which are only stored when debug mode is manually enabled in the app configuration file.
generallog- the application log files.
||The number of log files to retain.||
3 or 5
||Log all levels greater than or equal to the specified severity level. For example, a log_level of
debug, info, notice, warning,
error, critical, alert, emergency
Slack NotificationsIt's possible to simultaneously write to both the traditional log files above and also to Slack. This can be a great way to allow your engineers to act quickly in the event of application errors.
- Create an incoming web hook for your Slack channel, see https://api.slack.com/messaging/webhooks#getting_started.
- Make note of the incoming web hook URL, we'll need this later on.
- Create a
- Paste the below contents, replacing
INCOMING_WEBHOOKwith the URL from step 2 above, and save the file:
<?php return [ 'channels' => [ 'stack' => [ 'driver' => 'stack', 'channels' => ['generallog', 'slack'], 'ignore_exceptions' => false, ], 'slack' => [ 'driver' => 'slack', 'url' => 'INCOMING_WEBHOOK', 'username' => 'SupportPal Log', 'emoji' => ':boom:', 'level' => 'error', 'short' => true, 'context' => false, ], 'generallog' => [ 'driver' => 'custom', 'via' => \App\Logging\GeneralLogger::class, 'max_files' => 5, 'level' => 'info' ] ], ];
Once complete, every time a
production.ERROR is written to the log it will also be sent to your Slack channel.
You can toggle the
context variables depending on whether you want the full stack trace to be written.
We suggest to disable this because it can generate a lot of spam in the channel.