PHPackages                             assisjeferson/cakephp-databaselog - 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. assisjeferson/cakephp-databaselog

ActiveCakephp-plugin[Database &amp; ORM](/categories/database)

assisjeferson/cakephp-databaselog
=================================

CakePHP DatabaseLog Plugin

2.3.4(8y ago)176MITPHPPHP &gt;=5.5

Since Dec 2Pushed 8y ago1 watchersCompare

[ Source](https://github.com/assisjeferson/CakePHP-DatabaseLog)[ Packagist](https://packagist.org/packages/assisjeferson/cakephp-databaselog)[ Docs](https://github.com/dereuromark/CakePHP-DatabaseLog/)[ RSS](/packages/assisjeferson-cakephp-databaselog/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (3)Versions (11)Used By (0)

CakePHP DatabaseLog Plugin
==========================

[](#cakephp-databaselog-plugin)

[![Build Status](https://camo.githubusercontent.com/40de4d9c740588dd39744d2926845ceedbc32c133b8dbfce4293af58e41a9887/68747470733a2f2f6170692e7472617669732d63692e6f72672f6465726575726f6d61726b2f43616b655048502d44617461626173654c6f672e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/dereuromark/CakePHP-DatabaseLog)[![Coverage Status](https://camo.githubusercontent.com/407c2d4b0bd96b1ad1d3ce7abd9d813fe1be4c4aa26e67ac77760087ce1250b1/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f6465726575726f6d61726b2f43616b655048502d44617461626173654c6f672f6d61737465722e737667)](https://codecov.io/github/dereuromark/CakePHP-DatabaseLog?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/518910335545488978ac61d163fa772bfafa65dc0bbeb74c76cf744593da4b4f/68747470733a2f2f706f7365722e707567782e6f72672f6465726575726f6d61726b2f43616b655048502d44617461626173654c6f672f762f737461626c652e737667)](https://packagist.org/packages/dereuromark/CakePHP-DatabaseLog)[![Minimum PHP Version](https://camo.githubusercontent.com/e97290c4047b8fc1152177fc8110cab416f31f18159b722b6b633a210a198861/687474703a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344253230352e362d3838393242462e737667)](https://php.net/)[![License](https://camo.githubusercontent.com/c7176b8836636be167564332e52ab42bbad4d94e2ffccf87d88f9815f41b1adb/68747470733a2f2f706f7365722e707567782e6f72672f6465726575726f6d61726b2f43616b655048502d44617461626173654c6f672f6c6963656e73652e706e67)](https://packagist.org/packages/dereuromark/CakePHP-DatabaseLog)[![Total Downloads](https://camo.githubusercontent.com/17c12710f19073f1a847eb612a077a0b64863c540630d5263b1ce61eee27172e/68747470733a2f2f706f7365722e707567782e6f72672f6465726575726f6d61726b2f43616b655048502d44617461626173654c6f672f642f746f74616c2e706e67)](https://packagist.org/packages/dereuromark/CakePHP-DatabaseLog)

DatabaseLog engine for CakePHP applications.

**This branch is for CakePHP 3.x**

Features
--------

[](#features)

- Easy setup and almost no dependencies.
- Defaults to SQLite as single app application light weight approach.
- Ideal for multi app applications where logging to a file is just not convenient.
- If DB is used, fallback to SQLite in case the DB is not reachable.
- Simple admin interface to view/delete logs included.
- Basic monitoring and alert system included.
- Export to TXT files possible.

### Log Rotation

[](#log-rotation)

While file handling requires file log rotation and splitting into chunks of (compressed) files, a database approach can more easily keep the logs together in a single database. This is more convinient when looking through them or searching for something specific.

This plugin internally combines log entries of the exact same "content" into a single row with an increased count. Additionally you would want to add a cronjob triggered cleanup shell to keep the total size and row count below a certain threshold.

Demo
----

[](#demo)

Clone and install the [sandbox app](https://github.com/dereuromark/cakephp-sandbox), create some errors and browse the admin backend for the logs overview.

Or just attach it to your app directly. Time needed: 5 minutes.

Install
-------

[](#install)

### Composer (preferred)

[](#composer-preferred)

```
composer require dereuromark/cakephp-databaselog

```

Setup
-----

[](#setup)

Enable the plugin in your `config/bootstrap.php`:

```
Plugin::load('DatabaseLog', ['bootstrap' => true]);
```

or just call:

```
bin/cake plugin load DatabaseLog -b

```

You can simply modify the existing config entries in your `config/app.php`:

```
   'Log' => [
   	'debug' => [
   		'className' => 'DatabaseLog.Database'
   	],
   	'error' => [
   		'className' => 'DatabaseLog.Database'
   	],
   ],
```

This will use the `database_log` connection and an SQLite file database by default, stored in your `logs` folder.

### Using an actual database (optional)

[](#using-an-actual-database-optional)

Create a config setting in your `config/app.php` what database connection it should log to:

```
'DatabaseLog' => [
	'datasource' => 'my_datasource', // DataSource to use
]
```

It is recommended to not use the same datasource as your production server (`default`) because when the DB is not reachable logging to it will also not be possible. In that case it will fallback to SQLite file logging on this server instance, though.

Once the datasource is reachable and once the first log entry is being written, the database table (defaulting to `database_logs`) will be automatically created. No need to manually run any migration or SQL script here. You can also manually create the table before hand, if you prefer:

```
bin/cake Migrations migrate -p DatabaseLog

```

Or just copy the migration file into your app `/config/Migrations`, modify if needed, and then run it as part of your app migrations.

Fully tested so far are PostgreSQL and MySQL, but by using the ORM all major databases should be supported.

Usage
-----

[](#usage)

Anywhere in your app where you call `$this->log()` or `Log::write()` the DatabaseLog engine will be used.

```
$this->log('This is a detailed message logged to the database', 'error');
// or
Log::write('error', 'This is a detailed message logged to the database');
```

There is also a browsable web backend you can view your logs with.

See [docs](/docs) for more details.

###  Health Score

30

—

LowBetter than 65% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~129 days

Recently: every ~75 days

Total

10

Last Release

3010d ago

Major Versions

1.0 → 2.x-dev2014-12-02

PHP version history (2 changes)1.0PHP &gt;=5.2.8

2.0.0PHP &gt;=5.5

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/331113?v=4)[Jeferson Assis](/maintainers/assisjeferson)[@assisjeferson](https://github.com/assisjeferson)

---

Top Contributors

[![dereuromark](https://avatars.githubusercontent.com/u/39854?v=4)](https://github.com/dereuromark "dereuromark (33 commits)")[![ravage84](https://avatars.githubusercontent.com/u/625761?v=4)](https://github.com/ravage84 "ravage84 (28 commits)")[![webtechnick](https://avatars.githubusercontent.com/u/26438?v=4)](https://github.com/webtechnick "webtechnick (24 commits)")[![georgeconstantinou](https://avatars.githubusercontent.com/u/1926811?v=4)](https://github.com/georgeconstantinou "georgeconstantinou (3 commits)")[![anvyst](https://avatars.githubusercontent.com/u/227261?v=4)](https://github.com/anvyst "anvyst (2 commits)")[![assisjeferson](https://avatars.githubusercontent.com/u/331113?v=4)](https://github.com/assisjeferson "assisjeferson (2 commits)")[![mamchenkov](https://avatars.githubusercontent.com/u/437928?v=4)](https://github.com/mamchenkov "mamchenkov (2 commits)")[![liviakuenzli](https://avatars.githubusercontent.com/u/7348876?v=4)](https://github.com/liviakuenzli "liviakuenzli (1 commits)")

---

Tags

pluginloggingdatabasecakephplogs

### Embed Badge

![Health badge](/badges/assisjeferson-cakephp-databaselog/health.svg)

```
[![Health](https://phpackages.com/badges/assisjeferson-cakephp-databaselog/health.svg)](https://phpackages.com/packages/assisjeferson-cakephp-databaselog)
```

###  Alternatives

[dereuromark/cakephp-databaselog

A CakePHP plugin for storing and viewing application logs in the database

44165.0k2](/packages/dereuromark-cakephp-databaselog)[pgbi/cakephp3-soft-delete

SoftDelete plugin for CakePHP

87291.9k](/packages/pgbi-cakephp3-soft-delete)

PHPackages © 2026

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