PHPackages                             gordonzero/monolog-db - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. gordonzero/monolog-db

ActiveLibrary[Database &amp; ORM](/categories/database)

gordonzero/monolog-db
=====================

Laravel 5.6 Monolog custom database channel

v1.2(8y ago)39.4k↓16.7%2MITPHPPHP ^7.1.3

Since Apr 19Pushed 8y ago1 watchersCompare

[ Source](https://github.com/gordonzero/monolog-db)[ Packagist](https://packagist.org/packages/gordonzero/monolog-db)[ Docs](https://github.com/gordonzero/monolog-db)[ RSS](/packages/gordonzero-monolog-db/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

Laravel 5.6 Monolog Database Handler.
-------------------------------------

[](#laravel-56-monolog-database-handler)

This package will log errors into a database instead storage/log/laravel.log file.

### Installation

[](#installation)

```
composer require gordonzero/monolog-db

```

Open up `config/logging.php` and find the `channels` key. Add the following channel to the list.

```
'database' => [
    'driver' => 'custom',
    'via'=> \Logger\DatabaseLogger::class,
    'table'=> env('DB_LOG_TABLE', 'logs'),
    'connection' => env('DB_LOG_CONNECTION', env('DB_CONNECTION', 'mysql')),
],

```

Set up Environment Variables (see Below).

Migrate the tables.

```
php artisan migrate

```

Database Engines
----------------

[](#database-engines)

Make sure before you migrate the table that you have set the envirment veriable for the database engine. This is done by adding the following line to the `.env` file

```
DB_LOG_ENGINE=InnoDB

```

To use the whatever the default database engine is or to specify no database engine during the table migration use the following

```
DB_LOG_ENGINE=NONE

```

Environment configuration
-------------------------

[](#environment-configuration)

If you wish to change default table name to write the log into add the following definition in your `.env` file

```
DB_LOG_TABLE=logs

```

To change the database connection that is used to wright the logs add the following definition to your `.env` file

```
DB_LOG_CONNECTION=mysql

```

To make sure you are using the `database` channel for logging add it to the stack in your `config\logging.php` or change the following in your `.env` file

```
LOG_CHANNEL=database

```

Credits
-------

[](#credits)

Based on:

- \[Mark Hilton\] ()
- \[Pedro Fornaza\] ()

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2951d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b0ebc2037c43a33fe9af39cea35b293e3445f8284175249a1b11fe682637430f?d=identicon)[gordonzero](/maintainers/gordonzero)

---

Top Contributors

[![gordonzero](https://avatars.githubusercontent.com/u/9784991?v=4)](https://github.com/gordonzero "gordonzero (7 commits)")

---

Tags

loglaraveldatabasemonologlaravel56

### Embed Badge

![Health badge](/badges/gordonzero-monolog-db/health.svg)

```
[![Health](https://phpackages.com/badges/gordonzero-monolog-db/health.svg)](https://phpackages.com/packages/gordonzero-monolog-db)
```

###  Alternatives

[markhilton/monolog-mysql

Laravel 8 MySQL driver for Monolog

40140.8k](/packages/markhilton-monolog-mysql)[muhdfaiz/laravel-tail-db

Provide artisan command to monitor realtime database query executed from the application. Able to automatically run explain command for each of query received.

5826.7k](/packages/muhdfaiz-laravel-tail-db)[bradmkjr/monolog-wordpress

A handler for Monolog that sends messages to MySQL via WordPress Functions

2817.1k](/packages/bradmkjr-monolog-wordpress)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
