A Laravel Log Driver for Eloquent

1.2.0 2020-11-04 08:09 UTC

This package is auto-updated.

Last update: 2024-05-04 15:45:37 UTC


Latest Version on Packagist Software License Quality Score Total Downloads

A Laravel Log Driver for Eloquent


Via Composer

$ composer require juststeveking/eloquent-log-driver

After installation, publish the migrations using:

Then we can run our migration, which will create a table called database_logs.

$ php artisan migrate

Registering the driver with Laravel

In your .env file add the following:


Then add the following to your config/logging.php file under channels:

'eloquent' => [
    'driver' => 'custom',
    'via' => \JustSteveKing\EloquentLogDriver\Logger\EloquentLogger::class

That is it! Your logs will now automatically start appearing in the database.

Querying Logs

There is a small selection of helper scope available on the DatabaseLog model:

  • whereDebug()
  • whereInfo()
  • whereNotice()
  • whereWarning()
  • whereError()
  • whereCritical()
  • whereAlert()
  • whereEmergency()
  • whereLevel('log-level-case-insensitive')

All of the above will return an instance of an Eloquent Builder, allowing you to chain on further query parameters.


$ composer run test


Please see CONTRIBUTING and CODE_OF_CONDUCT for details.


If you discover any security related issues, please email juststevemcd@gmail.com instead of using the issue tracker.



The MIT License (MIT). Please see License File for more information.