PHPackages                             adamcrampton/laravel-database-logger - 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. [Logging &amp; Monitoring](/categories/logging)
4. /
5. adamcrampton/laravel-database-logger

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

adamcrampton/laravel-database-logger
====================================

Write Laravel logs to database table via Eloquent model

v1.2.5(6y ago)0832MITPHP

Since Feb 10Pushed 6y ago1 watchersCompare

[ Source](https://github.com/adamcrampton/laravel-database-logger)[ Packagist](https://packagist.org/packages/adamcrampton/laravel-database-logger)[ RSS](/packages/adamcrampton-laravel-database-logger/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (1)Versions (15)Used By (0)

laravel-database-logger
=======================

[](#laravel-database-logger)

Laravel logs to database table via custom Monolog channel + Eloquent model.

Installation
------------

[](#installation)

- Run `composer require adamcrampton/laravel-database-logger` in your project directory
- Add library service provider `AdamCrampton\LaravelDatabaseLogger\LogServiceProvider::class` to `config\app.php`
- Run `php artisan migrate` to set up the `logs` table
- In `config\logging.php`, add a new channel for the custom logs:

```
    'database' => [
        'driver' => 'custom',
        'via' => \AdamCrampton\LaravelDatabaseLogger\Services\LogMonoLog::class
    ]
]

```

- Update the log stack array in `config\logging.php` to include the new channel:

```
'stack' => [
    'driver' => 'stack',
    'channels' => ['daily', 'database'],
],
'database' => [
    'driver' => 'custom',
    'via' => \AdamCrampton\LaravelDatabaseLogger\Services\LogMonoLog::class
],

```

Configuration
-------------

[](#configuration)

A scheduled task is bundled with the package, which will delete rows in the `logs` table older than the expiration setting. To use this:

- Run `php artisan vendor:publish` to publish the `database_logger.php` config file to your project
- Run `php artisan config:cache` to ensure the project config is up to date
- Set the expiration length (in days) in your project's `config/database_logger.php` file
- Add an entry to the `app/Console/Commands/Kernel.php` file to schedule the cron job, something like: `$schedule->command('logs:prune')->dailyAt('07:45');`

To run the command manually: `php artisan logs:prune`

Usage
-----

[](#usage)

The package is pretty much a custom channel for Monolog, so you can use the existing facade and methods.

These columns are automatically populated when adding to the log:

- `description` The log message
- `origin` The origin value from the request header
- `type` Log type (`log`, `store`, `change`, or `delete`)
- `result` Log result (`success`, `neutral`, or `failure`)
- `level` Log message level (`emergency`, `alert`, `critical`, `error`, `warning`, `notice`, `info`, or `debug`)

Additionally, you can pass in a `category` and `sub_category` value, which will be saved to those columns when generating a log entry. Example:

`Log::info('test', ['category' => 'This is a category', 'sub_category' => 'This is a subcategory]);`

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity64

Established project with proven stability

 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

Every ~6 days

Recently: every ~15 days

Total

13

Last Release

2212d ago

Major Versions

v0.1.2 → v1.0.02020-02-10

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5696904?v=4)[Adam Crampton](/maintainers/adamcrampton)[@adamcrampton](https://github.com/adamcrampton)

---

Top Contributors

[![adamcrampton](https://avatars.githubusercontent.com/u/5696904?v=4)](https://github.com/adamcrampton "adamcrampton (23 commits)")

---

Tags

laravellogginglogs

### Embed Badge

![Health badge](/badges/adamcrampton-laravel-database-logger/health.svg)

```
[![Health](https://phpackages.com/badges/adamcrampton-laravel-database-logger/health.svg)](https://phpackages.com/packages/adamcrampton-laravel-database-logger)
```

###  Alternatives

[hosmelq/laravel-logsnag

Integrate the power of LogSnag's real-time event tracking into your Laravel application.

237.9k](/packages/hosmelq-laravel-logsnag)

PHPackages © 2026

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